This function is mainly used for imresize.
Code:
CLC; clear; Video = mmreader ('d: \ videotest \ Video 1. avi'); nframes = video. numberofframes; % get the number of frames H = video. height; % to get the height W = video. width; % to get the width rate = video. framerate; % preallocate movie structure. moV (1: nframes) = struct ('cdata', zeros (H, W, 3, 'int8'), 'colormap', []); % get each frame for I = 1: nframes mov (I ). CDATA = read (video, I); P = mov (I ). CDATA;
Format requirements in % imresize () []: [height and width]
Q = imresize (p, [720 960]); disp ('current Number of frames: '), DISP (I); imshow (P), title ('original image '); % Show Original Image if I <10 imwrite(q,strcat('{', int2str( I },'.jpg '), 'jpg'); % write else if I >=10 & I <100 then '), 'jpg '); else imwrite(q,strcat('00', int2str( I },'.jpg '), 'jpg'); End endend
MATLAB processes AVI video files as images of any size per frame