抽帧,视频截取图片
抽帧代码
import cv2
vc = cv2.VideoCapture("/home/图片/cloth/VID_20200611_091225.mp4") # 设置视频位置
c = 1
if vc.isOpened():
rval, frame = vc.read()
else:
rval = False
timeF = 15 # 设置帧数
while rval:
rval, frame =vc.read()
if(c%timeF==0):
cv2.imwrite('/home/图片/cloth/6/'+ str(c)+'.jpg',frame) # 设置图片存储的位置
c=c+1
cv2.waitKey(1)
vc.release()