Skip to content

Instantly share code, notes, and snippets.

@flyboy74
Last active October 7, 2021 15:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flyboy74/1dfe4052548445e9329dd2e36a38496f to your computer and use it in GitHub Desktop.
Save flyboy74/1dfe4052548445e9329dd2e36a38496f to your computer and use it in GitHub Desktop.
Capture images from webcam stream
import cv2
capture = cv2.VideoCapture(0)
capture.set(3, 320) #set width of frame
capture.set(4, 200) #set hieght of frame
capture.set(5, 20) #set FPS
capture.set(10, 20) #set brightness
successful = True
while successful:
successful, image = capture.read()
cv2.imshow("preview", image)
key = cv2.waitKey(1) & 0xFF
if key == ord("q"):
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment