Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions python webcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# id of the video capturing device to open. To open default camera using default backend just pass 0.
capture = cv2.VideoCapture(0)

# Check if the camera is opened successfully
if not capture.isOpened():
print("Error: Unable to access the camera.")
exit()

while True:
_, frame = capture.read()
# We give the Window a name of "Capture from Webcam", and we also give it the frame which is an numpy object.
Expand Down