Playing videos in Matlab

조회 수: 33 (최근 30일)
Abdussalam Elhanashi
Abdussalam Elhanashi 2019년 11월 1일
댓글: Lusanni Acosta-Rodriguez 2020년 12월 4일
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
Masumi Morishige
Masumi Morishige 2020년 10월 17일
편집: Masumi Morishige 2020년 11월 25일
I met the same error and solved it by installing "Computer Vision Toolbox" from "HOME > Add-Ons".
Although it's written in Japanese, I will share the article just in case.
I'm happy if this helps you.
Lusanni Acosta-Rodriguez
Lusanni Acosta-Rodriguez 2020년 12월 4일
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!

댓글을 달려면 로그인하십시오.

채택된 답변

Subhadeep Koley
Subhadeep Koley 2019년 11월 4일
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
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!

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by