We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent faeb10b commit 736f55cCopy full SHA for 736f55c
python webcam.py
@@ -0,0 +1,16 @@
1
+import cv2
2
+
3
+# id of the video capturing device to open. To open default camera using default backend just pass 0.
4
+capture = cv2.VideoCapture(0)
5
6
+while True:
7
+ _, frame = capture.read()
8
+ # We give the Window a name of "Capture from Webcam", and we also give it the frame which is an numpy object.
9
+ cv2.imshow("Capture from Webcam", frame)
10
+ # We know that the ASCII code for the Escape key is 27.
11
+ if cv2.waitKey(1) == 27:
12
+ break
13
14
+# Release the capture and destroy all OpenCV Windows.
15
+capture.release()
16
+cv2.destroyAllWindows()
0 commit comments