Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
matlab中的视频帧转换_Matlab_Image Processing_Video Processing - Fatal编程技术网

matlab中的视频帧转换

matlab中的视频帧转换,matlab,image-processing,video-processing,Matlab,Image Processing,Video Processing,我有一个从视频中提取帧的代码 addpath('E:\project\coding\wrk_ongoing\Images'); obj = mmreader('ace.mp4'); vid = read(obj); frames = obj.NumberOfFrames; %Read the Total number of frames and displyed in command window ST='.jpg'; cd frames for x = 1:5

我有一个从视频中提取帧的代码

addpath('E:\project\coding\wrk_ongoing\Images');
obj = mmreader('ace.mp4');
vid = read(obj);
frames = obj.NumberOfFrames; %Read the Total number of frames and displyed in     command window 
  ST='.jpg';

cd frames
for x = 1:5         %  extracting the 5 frames from video
  Sx=num2str(x);
  Strc=strcat(Sx,ST);
  Vid=vid(:,:,:,x);
  imwrite(Vid,Strc);
end
cd ..
此代码仅适用于某些视频。我使用.mp4扩展名测试了不同的视频。其中一些视频效果很好。但输入视频显示错误为

???在6处使用==>vid2frame时出错 初始化失败。(未发现中间过滤器的组合可使 连接。)


如何解决此问题?

该错误是由于视频文件本身造成的。从外观上看,MATLAB在读取该文件时遇到问题,可能是因为该文件编码错误,或者视频编码使用的编解码器不受MATLAB支持,或者您的计算机上不存在。。有关类似问题,请参见此问题:

这与MATLAB无关,但错误是您遇到的,答案是以与您的操作系统和MATLAB兼容的格式重新编码视频文件


祝你好运