Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create webcam_capture.py #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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()