一段matlab读取视频的代码,整理好便于大家以后使用
mov=VideoReader('视频路径‘);
framesnum=mov.NumberOfFrames;for i=1:100%或者 for i=1:framesnum
str='./img/b00000.bmp';
str(8)=num2str(floor(mod(i,100000)/10000));%如果代码中确实需要第b00000幅图的话,把此行和后面几行改成i-1就好了
str(9)=num2str(floor(mod(i,10000)/1000));
str(10)=num2str(floor(mod(i,1000)/100));
str(11)=num2str(floor(mod(i,100)/10));
str(12)=num2str(floor(mod(i,10)/1));
frame=read(mov,i);
imwrite(frame,str,'bmp');
end