MATLAB: How to get the current frame number of a video while playing in ‘implay’

currentframeImage Processing Toolboximplaynumber

I am playing a video using the 'implay' function, and I would like to figure out which frame of the video is currently showing when paused. How can I do this?

Best Answer

You can get the Current frame number when the video is paused as follows:
1. Play the video
fig = implay('Test.avi')
fig =
UnifiedScope with properties:
InstanceNumber: 1
Specification: [1x1 iptscopes.IMPlayScopeCfg]
MessageLog: []
DataSource: [1x1 matlabshared.scopes.source.FileSource]
Visual: [1x1 iptscopes.VideoVisual]
Parent: [1x1 Figure]
2. Pause the video.
3. Get the current frame number
CurrentFrameNumber = fig.DataSource.Controls.CurrentFrame
CurrentFrameNumber =