フィルターのクリア

How to extract different frames in a video and save these frames in a file?

3 ビュー (過去 30 日間)
ezhil K
ezhil K 2018 年 12 月 28 日
回答済み: Image Analyst 2018 年 12 月 28 日
I have a problem in extracting the video frames.My code does'nt work.Can anyone help me in correcting my mistakes?
vid=VideoReader('Documents\MATLAB\Video\WIN_20181128_00_37_49_Pro.MP4');
numFrames = vid.NumberOfFrames;
n=numFrames;
Folder = 'Documents\MATLAB\Video\';
for iFrame = 1:n
frames = read(vid, iFrame);
imwrite(frames, fullfile(Folder, sprintf('%06d.jpg', iFrame)));
end
FileList = dir(fullfile(Folder, '*.jpg'));
for iFile = 1:length(FileList)
aFile = fullfile(Folder, FileList(iFile).name);
img = imread(aFile);
end

採用された回答

Image Analyst
Image Analyst 2018 年 12 月 28 日
Off the top of my head it looks okay, though your folder will be relative to your current folder, not your root folder. And your final for loop doesn't really do anything except read in files - it doesn't display them or anything.
Perhaps if you described what "doesn't work" means.
I attach a program that does the same thing and I know works. Just change the video filename, output folder name, etc.

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by