read videos in Matlab

4 views (last 30 days)
Hi Guys
I wantt help fpr following code instade of reading the frames of videos i want to read video as normal playing
vidReader = VideoReader('004.avi');
vidPlayer = vision.DeployableVideoPlayer;
i = 1;
results = struct('Boxes',[],'Scores',[]);
I = readFrame(vidReader);
i = i+1;

Accepted Answer

Subhadeep Koley
Subhadeep Koley on 5 Nov 2019
Hi, your code is almost correct only you have add some pause() between every frame otherwise you won’t be able to see all the frames. The pause time should be ideally 1/FrameRate for viewing the video in its original speed. Refer to the code below.
vidReader = VideoReader('rhinos.avi'); % Read your video here
vidPlayer = vision.DeployableVideoPlayer;
I = readFrame(vidReader);
pause((1/vidReader.FrameRate)); % pause of value (1/FrameRate)
Or else if you only want to play the video you can use the function implay().
implay('rhinos.avi'); % Read your video here
And hit the ‘Play’ button.
Hope this helps!
Abdussalam Elhanashi
Abdussalam Elhanashi on 5 Nov 2019
Hi Subhadeep Koley thanks for your comment how can i calculate the frame rate per second for object detection when i play the video because when i got the deployable video player it does not show f / s

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by