Hi,
Does anybody knows how can I change the following code to use for a pre-recorded video (mp4).?
i need to preview of a pre-recorded video, not live one!
Thanks.
*i am using matlab R2020a
% Create a video input object.
vid = videoinput('winvideo', 1, 'YUY2_640x480'); set(vid,'ReturnedColorSpace','grayscale');% Create a figure window. This example turns off the default
% toolbar, menubar, and figure numbering.
figure('Toolbar','none',... 'Menubar', 'none',... 'NumberTitle','Off',... 'Name','My Preview Window');% Create the image object in which you want to display
% the video preview data. Make the size of the image
% object match the dimensions of the video frames.
vidRes = vid.VideoResolution;nBands = vid.NumberOfBands;hImage = image( zeros(vidRes(2), vidRes(1), nBands) );% Display the video data in your GUI.
preview(vid, hImage);
Best Answer