做個(gè)學(xué)習(xí)記錄虐先,用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腳本
這三個(gè)文件同在一個(gè)目錄下要销,都在workdirectory下