Last active
March 28, 2021 16:04
-
-
Save yokeshrana/669f1ad52a8f683d1fa8bc1a666c60a7 to your computer and use it in GitHub Desktop.
Reading from Web Cam
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 | |
vid = cv2.VideoCapture(0) # instead of file path we will use the id of the device (webcam) | |
#now we define some specific parameter for the webcam | |
vid.set(3,640) | |
vid.set(4,480) | |
#Rest Code is same as basic video read | |
while vid.isOpened(): # Used to check if camera is opened or not | |
success,img=vid.read() | |
if success: | |
cv2.imshow("Video",img) | |
if cv2.waitKey(1) & 0xFF == ord('q'): | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment