Created
December 13, 2018 21:27
-
-
Save aryamanarora/4138fe77b79cc4217dff12793820e84d 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 os | |
import numpy | |
import cv2 | |
folder = input("Path to the folder where the videos are: ") | |
files = os.listdir(folder) | |
i = 0 | |
n = len(files) | |
while True: | |
vid = cv2.VideoCapture(folder + '/' + files[i]) | |
while vid.isOpened(): | |
ret, frame = vid.read() | |
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) | |
cv2.imshow('frame',gray) | |
if cv2.waitKey(1) & 0xFF == ord('q'): | |
break | |
vid.release() | |
i += 1 | |
i %= n | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment