代码拉取完成,页面将自动刷新
import cv2, sys
import numpy as np
import glob
import pdb
# path to where you want to save extracted frames
SAVE_PATH = ""
# Path to your video file
filename = ""
def video_to_frames(video_filename):
source_video = cv2.VideoCapture(video_filename)
n_frames = source_video.get(cv2.CAP_PROP_FRAME_COUNT)
i = 0
while i <= n_frames:
ret, frame = source_video.read()
if ret:
cv2.imwrite(SAVE_PATH + "frame_" + str(i) + ".jpg", frame)
else:
i += 1
continue
i += 1
video_to_frames(filename)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。