MATLAB Answers

K E
0

How to rewind in VideoReader?

K E
さんによって質問されました 2016 年 3 月 9 日
最新アクティビティ Walter Roberson
さんによって 回答されました 2016 年 3 月 12 日
If I have read several frames in VideoReader, how can I rewind to the first frame? In this example, let's say I stop the replay after 5 frames (enter 0 when prompted at the 5th frame). After that I want to rewind to the 1st frame, for example if I want to display the first frame again. How do I rewind?
vidObj = VideoReader('xylophone.mp4'); % Make a video object of an example video on everyone's path
iStop = []; % Stop the frame display if this is not empty
while hasFrame(vidObj) & isempty(iStop) % Loop through all frames
vidFrame = readFrame(vidObj);
imagesc(vidFrame);
iStop = input('0 to stop, return to continue ');
end

  4 件のコメント

K E
2016 年 3 月 10 日
The problem is that my original sequence starts at a time offset (vidObj.CurrentTime), and I would like to rewind back to the first frame in that sequence. It seems like you should be able to rewind frames by 'resetting' vidObj so the next readFrame call starts back at the first frame in the sequence but I don't know how.
Walter Roberson
2016 年 3 月 10 日
time_to_remember = vidObj.CurrentTime;
.... do some things that read frames ...
vidObj.CurrentTime = time_to_remember; %position back to where we were
Image Analyst
2016 年 3 月 11 日
Put these comments in the "Answers" section.

サインイン to comment.

1 件の回答

Walter Roberson
回答者: Walter Roberson
2016 年 3 月 12 日
 採用された回答

time_to_remember = vidObj.CurrentTime;
.... do some things that read frames ...
vidObj.CurrentTime = time_to_remember; %position back to where we were

  0 件のコメント

サインイン to comment.



Translated by