2023-09-24 13:34:10 +00:00
|
|
|
import cv2
|
|
|
|
|
2023-11-06 20:17:14 +00:00
|
|
|
# Open a video capture object
|
|
|
|
cap = cv2.VideoCapture(0)
|
2023-09-24 15:53:12 +00:00
|
|
|
|
2023-11-06 20:17:14 +00:00
|
|
|
while(True):
|
|
|
|
# Capture frame-by-frame
|
|
|
|
ret, frame = cap.read()
|
2023-09-24 15:53:12 +00:00
|
|
|
|
2023-11-06 20:17:14 +00:00
|
|
|
# Display the resulting frame
|
|
|
|
cv2.imshow('frame',frame)
|
2023-09-24 15:53:12 +00:00
|
|
|
|
2023-11-06 20:17:14 +00:00
|
|
|
# Break the loop on 'q' key press
|
|
|
|
if cv2.waitKey(1) & 0xFF == ord('q'):
|
|
|
|
break
|
2023-09-24 15:53:12 +00:00
|
|
|
|
2023-11-06 20:17:14 +00:00
|
|
|
# When everything done, release the capture and destroy the window
|
|
|
|
cap.release()
|
2023-09-24 13:34:10 +00:00
|
|
|
cv2.destroyAllWindows()
|