赞
踩
上代码!
import os import cv2 cap = cv2.VideoCapture('视屏路径') while (1): ret, frame = cap.read() if ret == False: break frame_index = 0 frame_count = 0 if cap.isOpened(): success = True else: success = False while (success): success, frame = cap.read() print("---> 正在读取第%d帧:" % frame_index, success) if frame_index % 1 == 0 and success: resize_frame = cv2.resize(frame, (1920, 1080), interpolation=cv2.INTER_AREA) cv2.imwrite('./save_path' + "%d.jpg" % frame_count, resize_frame) frame_count += 1 frame_index += 1 cap.release()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。