Re-reading a specific frame using VideoReader returns inconsistent frames

I'm using VideoReader on R2011a to read in a file that has a variable frame rate. My code looks something like this:
f = figure;
frameNum = 3600; %arbitrary frame number
for i = 1:100
mov(frameNum).cdata = read(vidObj, frameNum);
imagesc(mov(frameNum).cdata);
drawnow;
end
This code should read and display the same video frame over the 100 reads. However, when I run it, the picture moves - it does not grab the same frame every time. The read function appears to iterate on every call.
Is this expected behaviour? What can I do to counteract this and ensure that I am grabbing the same frame every time?
Thank you for your help.

Answers (0)

Products

Asked:

on 7 Mar 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!