Created
November 15, 2018 17:46
-
-
Save ayush29feb/2d8eaa9161ee81d2a1a0bf67bbf0002e to your computer and use it in GitHub Desktop.
Converting a video to photos
This file contains hidden or 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 | |
vidcap = cv2.VideoCapture('/gdrive/<filepath>') | |
success,image = vidcap.read() | |
count = 0 | |
success = True | |
while success: | |
success,image = vidcap.read() | |
cv2.imwrite("/gdrive/<filepath>" % count, image) # save frame as JPEG file | |
if cv2.waitKey(10) == 27: # exit if Escape is hit | |
break | |
count += 1 | |
print (success) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment