import cv2
capture = cv2.VideoCapture('C:/Users/TECH013/Desktop/park_road.mp4')
index=0
ind=0
while(capture.isOpened()):
ret, frame = capture.read()
if ret:
cv2.imshow('frame', frame)
ind+=1
if ind%18==0:
index+=1
cv2.imwrite('./pictures/%s.jpg'%index,frame)
if cv2.waitKey(10) & 0xFF == ord('q'):
break
else:
break
capture.release()
cv2.destroyAllWindows()
Python 视频存成图片
最新推荐文章于 2023-06-14 15:31:24 发布