Thursday, March 3, 2011

Extract frames from video and display it ( using MATLAB )

% Everything starting with % sign is a comment

% i) First of all set the current directory of matlab to C: , if you don't know how to , then skip this step

% ii) Copy your video to c: drive

% iii) now replace the video with exact video name , the video should be avi and should be of less resolution for effective processing.

% code starts below



video=mmreader('video.avi'); % read the video

nframes= video.numberofframes; % total number of frames in the video

cd c:\\ % sets the current directory to C: , if you even didn't set , it will set it to C:

for i=1:nframes

image = read(video ,i); % to access each frame

imshow(image); % to show each frame

end % end of for loop