Skip to content

Instantly share code, notes, and snippets.

@aimerneige
Created May 13, 2022 15:31
Show Gist options
  • Save aimerneige/84e89caa9693c422f27b90578049cfd0 to your computer and use it in GitHub Desktop.
Save aimerneige/84e89caa9693c422f27b90578049cfd0 to your computer and use it in GitHub Desktop.
opencv camera
# -*- coding: utf-8 -*-
import cv2
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
if ret:
frame = cv2.resize(frame, (0, 0), fx=0.5, fy=0.5)
cv2.imshow('camera', frame)
else:
break
if cv2.waitKey(10) == ord('q'):
# press q to exit
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment