为了其他同学解惑,为了自己以后复习方便!
%%%%%视频切成图像序列
fileName = 'C:\\.....\\xxxx.mp4';
%image_path=
obj = VideoReader(fileName);
numFrames = obj.NumberOfFrames;% 读取视频的帧数CurrentTime
for i = 1 : numFrames
frame = read(obj,i);% 读取每一帧
imshow(frame);%显示每一帧
namestyle=sprintf('%06d',i);
imwrite(frame,strcat(namestyle,'.png'),'png');% 保存每一帧
%imwrite(frame,strcat(num2str(i),'.png'),'png');% 保存每一帧
end