Get Current Frame out of Video Reader Object?

12 ビュー (過去 30 日間)
Alicia Wüst
Alicia Wüst 2021 年 7 月 25 日
回答済み: Alicia Wüst 2021 年 7 月 28 日
Hi everybody,
when I stopp playing an VideoReader Object, is there a way to get the current videoFrame?
Something like currentFrame etc.?
Best regards.

回答 (2 件)

Shadaab Siddiqie
Shadaab Siddiqie 2021 年 7 月 28 日
From my understanding you want to get the frame when you pause a video. If you know at which time you will be pausing the video the you can get the frame:
time = 3.5 % suppose you need frame at 3.5th second
v = VideoReader('Test.avi','CurrentTime’, time);
If you really want to pause video, one possible workaround would be to use implay to pause video and get the frame like so:
% use implay to get frame time
fig = implay('Test.avi')
% pause video and get the exact time of the video
CurrentFrameTime = fig.DataSource.Controls.TimeOfDisplayData;
% use videoreader to get the frame from the time
v = VideoReader('Test.avi','CurrentTime',CurrentFrameTime);
f = readFrame(v);
imshow(f)

Alicia Wüst
Alicia Wüst 2021 年 7 月 28 日
Thanks for your help! I‘ll try this today.

Community Treasure Hunt

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

Start Hunting!

Translated by