Created
June 29, 2018 02:31
-
-
Save italojs/45891f24615f914f6e809abd3da3f40c 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 cv2 | |
# if (you have only 1 webcam){ set device = 0} else{ chose your favorite webcam setting device = 1, 2 ,3 ... } | |
cap = cv2.VideoCapture(0) | |
while True: | |
# Getting our image by webcam and converting it into a gray image scale | |
_, image = cap.read() | |
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) | |
# show the gray image | |
cv2.imshow("Output", image) | |
#key to give up the app. | |
k = cv2.waitKey(5) & 0xFF | |
if k == 27: | |
break | |
cv2.destroyAllWindows() | |
cap.release() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment