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'
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Mohammad Sami
on 4 Sep 2020
You can use the VideoReader to read a video file.
v = VideoReader('xylophone.mp4');
while hasFrame(v)
frame = readFrame(v);
end
2 Comments
Mohammad Sami
on 5 Sep 2020
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
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!