17 lines
414 B
Python
17 lines
414 B
Python
import cv2
|
|
videopath = 'C:/workspace/le-yolo/res/2.mp4'
|
|
video = cv2.VideoCapture(videopath)
|
|
num = 0
|
|
if video.isOpened():
|
|
ret, frame = video.read()
|
|
else:
|
|
ret = False
|
|
timeF = 8
|
|
filepath = 'C:/workspace/le-yolo/data/images/train/t2_'
|
|
while ret:
|
|
ret, frame = video.read()
|
|
if num % timeF == 0:
|
|
cv2.imwrite(filepath + str(num) + '.jpg', frame)
|
|
num = num + 1
|
|
cv2.waitKey(1)
|
|
video.release() |