Playing videos in Matlab
31 views (last 30 days)
Show older comments
Abdussalam Elhanashi
on 1 Nov 2019
Commented: Lusanni Acosta-Rodriguez
on 4 Dec 2020
Hi Guys
I wantt help fpr following code instade of reading the frames of videos i want to read video as normal playing
load('Detector.mat');
vidReader = VideoReader('004.avi');
vidPlayer = vision.DeployableVideoPlayer;
i = 1;
results = struct('Boxes',[],'Scores',[]);
while(hasFrame(vidReader))
I = readFrame(vidReader);
step(vidPlayer,I);
i = i+1;
3 Comments
Lusanni Acosta-Rodriguez
on 4 Dec 2020
Thanks Masumi! After installing the "Computer Vision Toolbox" the error went away. Now I am facing another one. But, with respect to the Vision Toolbox is good!
Again, thanks!
Accepted Answer
Subhadeep Koley
on 4 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 to view the video in its original speed. Refer to the code below.
vidReader = VideoReader('rhinos.avi'); % Read your video here
vidPlayer = vision.DeployableVideoPlayer;
while(hasFrame(vidReader))
I = readFrame(vidReader);
step(vidPlayer,I);
pause((1/vidReader.FrameRate)); % pause of value (1/FrameRate)
end
implay('rhinos.avi'); % Read your video here
And hit the ‘Play’ button.
Hope this helps!
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!