做个学习记录,用python脚本将视频按帧拆分成图片
python 2.7
#coding=utf-8
import cv2
print(2)
vc=cv2.VideoCapture("IMG_8379.MOV")
c=1
if vc.isOpened():
rval,frame=vc.read()
else:
rval=False
while rval:
rval,frame=vc.read()
cv2.imwrite('image/IMG_8379/'+str(c)+'.jpg',frame)
c=c+1
cv2.waitKey(1)
vc.release()
image_8379.mov
image
python脚本
这三个文件同在一个目录下,都在workdirectory下