Skip to content

Instantly share code, notes, and snippets.

@codewithpom
Created July 14, 2021 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codewithpom/a737daa2dd9787254a52eff8d788da17 to your computer and use it in GitHub Desktop.
Save codewithpom/a737daa2dd9787254a52eff8d788da17 to your computer and use it in GitHub Desktop.
import cv2
# I used this line because I have external camera.
# You do not need to use cv2.CAP_DSHOW if you do not use external camera
cam = cv2.VideoCapture(0, cv2.CAP_DSHOW)
while True:
ret, frame = cam.read()
cv2.imshow("My Webcam", frame)
key = cv2.waitKey(25)
if key == ord('q'):
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment