資源簡介
這個代碼是我親自調試通過的,在matlab下完整跑通,應該還不錯的,可以下載看看
代碼片段和文件信息
?close?all
?clear?all
?clc
?
?[filename?pathname]?=?uigetfile(‘*.avi‘‘please?select?a?avi?file‘);
?fprintf(‘filename?=?%s?\npathname?=?%s?\n\n‘?filename?pathname);?
?if?ischar(filename)?
?????fprintf(‘choose?file?success.\n\n‘);
?????
?video?=?aviinfo([pathname?filename]);
?len?=?video.Numframes;?%?get?length?of?the?video?
?fprintf(‘length?of?video?:?%d?\n\n‘?len);
?dir=strcat(pathnamestrrep(filename‘.avi‘‘‘)‘\pic‘);
?mkdir(dir);?%?create?folder?for?saving?picture
?fn=strrep(filename‘.avi‘‘‘);??%?replace?the?.avi?with?‘‘;
?for?k?=?1?:?len?
?????video_videotape(k)?=?aviread(video.Filename?k);
?????frame=video_videotape(k).cdata;
?????figure
?????imshow(frame);????
?????pause(2);??%?delay?2?seconds
?????imwrite(framestrcat(dir‘\‘fn‘-avi-0‘int2str(k)‘.
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????182??2012-08-16?22:53??ReadManyImages.m
?????文件????????829??2012-08-16?17:17??ConVideoToImage.m
-----------?---------??----------?-----??----
?????????????????1011????????????????????2
評論
共有 條評論