Showing posts with label dividing video and storing. Show all posts
Showing posts with label dividing video and storing. Show all posts

Tuesday, 15 July 2014

reading inbuilt MATLAB video and saving every fifth frame to C: drive frames folder

reading inbuilt MATLAB video and saving every fifth frame to C: drive frames folder
clear all;
videoObject = mmreader('xylophone.mpg');
nFrames = videoObject.NumberOfFrames;
OutputPath='C:/frames/';
mkdir(OutputPath);
for i=1:nFrames
if(mod(i,5) == 0)

fileName=strcat(OutputPath,int2str(i),'.jpg');
frameRead = read(videoObject, i);  
imwrite(frameRead,fileName);

end
end