how can i feed the pre-recorded video to the following code instead of live video(from webcam)/ or how can i save the live video in a 'disk'
2 ビュー (過去 30 日間)
古いコメントを表示
Greeting to the community, I am using matlab for image processing. anybody knows that how can i feed a pre-recorded video to the following code instead of live video(from webcam)?
I need to input pre-recroded video, or using live video but save the video in a folder first (using 'disk' instaed of 'memory') before proceeding the next stage (image processing).
a part of the code:
% Select video format
hws = imaqhwinfo ;
hw = imaqhwinfo(hws.InstalledAdaptors{end},1) ;
VideoFormat = hw.SupportedFormats;
% Select video format
hws = imaqhwinfo ;
hw = imaqhwinfo(hws.InstalledAdaptors{end},1) ;
VideoFormat = hw.SupportedFormats;
set(handles.text_vf, 'String', ['Video Format : ', 'YUY2_640x480']);
% set videoinput object
video = videoinput('winvideo',1,'YUY2_640x480');
set(video,'FramesPerTrigger',10);
set(video,'ReturnedColorSpace','grayscale');
set(video,'LoggingMode','memory');
triggerconfig(video,'immediate');
set(video,'FramesAcquiredFcnCount', 3);
set(video,'FramesAcquiredFcn', {@FramesAcquiredFcn,hObject});
% Preview UPDATE
vidRes = get(video, 'VideoResolution');
vidWin = image(zeros(vidRes(2), vidRes(1)),'Parent',handles.Preview);
preview(video,vidWin);
0 件のコメント
回答 (1 件)
Mohammad Sami
2020 年 9 月 4 日
You can use the VideoReader to read a video file.
v = VideoReader('xylophone.mp4');
while hasFrame(v)
frame = readFrame(v);
end
2 件のコメント
Mohammad Sami
2020 年 9 月 5 日
Video reader class does any property video Resolution. If you want resolution you will have to get Height and width properties.
Documentation of video reader is available here
https://www.mathworks.com/help/matlab/ref/videoreader.html
参考
カテゴリ
Help Center および File Exchange で Image Acquisition Support Packages for Hardware Adaptors (Generic Video Interface) についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!