Skip to content

Instantly share code, notes, and snippets.

@jfjensen
Last active August 26, 2022 13:12
Show Gist options
  • Save jfjensen/cc625c562f3a86a9875bae24b23c3abb to your computer and use it in GitHub Desktop.
Save jfjensen/cc625c562f3a86a9875bae24b23c3abb to your computer and use it in GitHub Desktop.
A little program for taking pictures with a webcam
import cv2
from datetime import datetime
from imutils.video import VideoStream
import time
vs = VideoStream(src=0).start()
time.sleep(2.0)
while(True):
frame = vs.read()
cv2.imshow('frame',frame)
key = cv2.waitKey(1) & 0xFF
if key == ord('q'):
break
if key == ord('c'):
cv2.imwrite(f"calibrate_{datetime.now().strftime('%Y%m%d_%H%M%S')}.png", frame)
vs.stop()
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment