python 视频转图像

import cv2
path=r'C:\Users\Qing\Desktop\eval_box_video\eval\box\video\seq_00.mp4'
cap = cv2.VideoCapture(path)
suc = cap.isOpened()  
frame_count = 0
while suc:
    frame_count += 1
    suc, frame = cap.read()
    params = []
    params.append(2)  
    cv2.imwrite(r'C:\Users\Qing\Desktop\eval_box_video\eval\box\video\frames\%d.jpg' % frame_count, frame, params)

cap.release()
print('unlock movie: ', frame_count)

你可能感兴趣的:(python)