Created
September 18, 2020 20:46
-
-
Save aliyevorkhan/da13427afabec8963f2be17fc0123686 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
path = '/home/orkhan/Desktop/train/' | |
cap = cv2.VideoCapture('video.mp4') | |
i = 0 | |
counter = 0 | |
while cap.isOpened(): | |
ret, frame = cap.read() | |
if not ret: | |
break | |
if counter % 10 == 0: | |
cv2.imwrite(path + 'train_img_' + str(i) + '.jpg', frame) | |
i += 1 | |
counter += 1 | |
cap.release() | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment