首页 > 代码库 > matlab processing for video

matlab processing for video

[filename,pathname,fileindex]=uigetfile(‘*.avi‘,‘请选择一个Avi文件‘);video_info=aviinfo([pathname filename]);% info = % Filename: 视频名称% FileSize: 视频大小% FileModDate: 视频创建日期% NumFrames: 视频总帧数% FramesPerSecond: 视频采集速率% Width: 视频宽度% Height: 视频高度% ImageType: ‘truecolor‘ 图像模式% VideoCompression: ‘DIV3‘ 视频图像压缩格式% Quality: 0% NumColormapEntries: 0LEN=video_info.NumFrames; %获得视频长度for k=1:LEN video_videotape(k)=aviread(video_info.Filename,k); video_image=video_videotape(k).cdata; if k<10 imwrite(video_image,strcat(‘0000‘,int2str(k),‘.bmp‘),‘bmp‘);%把每帧图像存入硬盘 elseif k>=10 & k<100 imwrite(video_image,strcat(‘000‘,int2str(k),‘.bmp‘),‘bmp‘);%把每帧图像存入硬盘 elseif k>=100 & k<1000 imwrite(video_image,strcat(‘00‘,int2str(k),‘.bmp‘),‘bmp‘);%把每帧图像存入硬盘 elseif k>=1000 & k<1000 imwrite(video_image,strcat(‘0‘,int2str(k),‘.bmp‘),‘bmp‘);%把每帧图像存入硬盘 else imwrite(video_image,strcat(int2str(k),‘.bmp‘),‘bmp‘);%把每帧图像存入硬盘 end end