フィルターのクリア

Read specific frames from a video

3 ビュー (過去 30 日間)
Naseer Khan
Naseer Khan 2016 年 8 月 21 日
回答済み: Tuan Nguyen 2017 年 5 月 30 日
I want to read some specific frames from a video.Following is my code
videoData=VideoReader(absPath);
i=1;
while hasFrame(videoData)
img = readFrame(videoData);
filename = [sprintf('%03d',i) '.jpg'];
fullname = fullfile(savePath,filename);
imwrite(img,fullname) % Write out to a JPEG file (img1.jpg, img2.jpg, etc.)
i = i+1;
end
Issue is that I have seen on sites that "read" method got used but it is NOT available in Matlab 2015.Is there some way? Please also tell me what would I need to do if I need to extract frames after a particular time delay?
regards

回答 (2 件)

Geoff Hayes
Geoff Hayes 2016 年 8 月 21 日
Nasser - try using read instead which was introduced in R2010b (and is to be replaced by readFrame).
  2 件のコメント
Naseer Khan
Naseer Khan 2016 年 8 月 21 日
readFrame does not have options like frame number or read frame after some time?
Geoff Hayes
Geoff Hayes 2016 年 8 月 21 日
Nasser - I don't understand. Do you have the function readFrame or not?

サインインしてコメントする。


Tuan Nguyen
Tuan Nguyen 2017 年 5 月 30 日
For example if i want to read frame 10 to 20:
arr=10:20; i=1; while hasFrame(videoData) if(i>max(arr)) break; img = readFrame(videoData); if (any(i==arr) filename = [sprintf('%03d',i) '.jpg']; fullname = fullfile(savePath,filename); imwrite(img,fullname)
i = i+1;
end

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by