视频转图片
代码如下:
ivpath ='D:\video\正常.mp4';
v_b = VideoReader(ivpath);
% 获取视频的帧率和总帧数
frameRate_b = v_b.FrameRate;
totalFrames_b = v_b.NumFrames;
i = 1;
while 1
if ~hasFrame(v_b)
break;
end
frame = read(v_b,i);
temp=strcat('D:\video\正常\D',num2str(i,'%05d'),'.','jpg');
imwrite(frame,temp);
i = i+1;
end
注意: 图片保存路径文件夹 “ D:\video\正常\ ” 必须存在

浙公网安备 33010602011771号