Files
detection_pot/camera.py
2023-11-23 19:22:32 +01:00

22 lines
430 B
Python

import numpy as np
import cv2
cap = cv2.VideoCapture(0)
if not cap.isOpened():
print("Cannot open camera")
exit()
while True:
ret, frame = cap.read()
if not ret:
print("Can't receive frame (stream end?). Exiting ...")
break
#video = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
cv2.imshow("frame", frame)
if cv2.waitKey(1) == ord("q"):
break
cap.release()
cv2.destroyAllWindows()