Skip to content

Instantly share code, notes, and snippets.

@sengstacken
Created June 3, 2020 13:23
Show Gist options
  • Save sengstacken/76930f480f76471d2d230a93e21f1e15 to your computer and use it in GitHub Desktop.
Save sengstacken/76930f480f76471d2d230a93e21f1e15 to your computer and use it in GitHub Desktop.
python code to save video frames to images
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