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
17 changes: 17 additions & 0 deletions webcam_capture.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import numpy as np
import cv2

# Select capture from a source(Replace 0 with video file for debugging purposes if no webcam available)
capture = cv2.VideoCapture(0)

# Capture video input(Enter q to stop capture)
while(True):
ret, frame = capture.read()
grayscale = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame', grayscale)
if cv2.waitKey(1) & 0xFF == ord('q'):
break

# Release capture
capture.release()
cv2.destroyAllWindows()