for frame = 1 : numberOfFrames
thisInputFrame = read(inputVideoReaderObject, frame);
image(thisInputFrame);
if ndims(thisInputFrame) == 3
thisInputFrame = rgb2gray(thisInputFrame);
end
axis on;
axis image;
caption = sprintf('Frame %4d of %d.', frame, numberOfFrames);
title(caption, 'FontSize', fontSize);
drawnow;
outputFrame = imresize(thisInputFrame, [outputVideoRows, outputVideoColumns]);
writeVideo(outputVideoWriterObject, outputFrame);
progressIndication = sprintf('Processed frame %4d of %d.', frame, numberOfFrames);
disp(progressIndication);
numberOfFramesWritten = numberOfFramesWritten + 1;
end
Best Answer