read videos in Matlab
2 ビュー (過去 30 日間)
古いコメントを表示
Abdussalam Elhanashi
2019 年 11 月 2 日
編集済み: Abdussalam Elhanashi
2019 年 11 月 5 日
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;
0 件のコメント
採用された回答
Subhadeep Koley
2019 年 11 月 5 日
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;
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!
3 件のコメント
Subhadeep Koley
2019 年 11 月 5 日
In your code, the variable vidReader.FrameRate contains the frame rate of the video read by VideoReader.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!