Created
July 1, 2020 09:40
-
-
Save dishankjindal1/86c844747e0d4b6e140909d38fc1b218 to your computer and use it in GitHub Desktop.
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
from cv2 import cv2 | |
video = cv2.VideoCapture(0) | |
if not video.isOpened(): | |
print("Cannot open camera") | |
exit() | |
while True: | |
ret, frame = video.read() | |
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) | |
cv2.imshow('frame', gray) | |
if cv2.waitKey(1) == ord('q'): | |
break | |
video.release() | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment