將影片檔轉成圖檔

import os

import cv2

vidcap = cv2.VideoCapture('video/MVI_3073.mov')

filename='MVI_3073'
filepath = './images/{0}'.format(filename)
if not os.path.exists(filepath):
 os.makedirs(filepath)

count = 0
while success:
 cv2.imwrite(filepath+"/image_%d.jpg" % count, image)
 success, image = vidcap.read()
 print('Saved image ', count)
 count += 1

image

 

arrow
arrow
    全站熱搜

    門外漢 發表在 痞客邦 留言(0) 人氣()