Created
June 3, 2020 13:23
-
-
Save sengstacken/76930f480f76471d2d230a93e21f1e15 to your computer and use it in GitHub Desktop.
python code to save video frames to images
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 | |
fname = 'eye_detection.avi' | |
vidcap = cv2.VideoCapture(fname) | |
success,image = vidcap.read() | |
count = 0 | |
while success: | |
cv2.imwrite("frame%d.jpg" % count, image) # save frame as JPEG file | |
success,image = vidcap.read() | |
print('Read a new frame: ', success) | |
count += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment