How do I save the frames of a video into a cell array?

2 ビュー (過去 30 日間)
MF
MF 2017 年 11 月 20 日
回答済み: KSSV 2017 年 11 月 20 日
I used VideoReader to load the video from my down loads and read() to read each frame. How do I save the image and then save that image to the cell of a preallocated cell array?
v=VideoReader(movieFile);
numFrames=v.NumberofFrames;
c=cell(1,numFrames);
for a=1:numFrames
frame=read(v,a);
imwrite(frame,['Image' int2str(a), '.jpg'])
c(a)=frame;
end

採用された回答

KSSV
KSSV 2017 年 11 月 20 日
vidObj = VideoReader('C:\Users\Public\Videos\Sample Videos\Wildlife.wmv');
numFrames = 0;
iwant = cell([],1) ;
while hasFrame(vidObj)
F = readFrame(vidObj);
numFrames = numFrames + 1;
iwant{numFrames} = F ;
imagesc(F)
drawnow
end
numFrames

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by