Skip to content

Commit 8b18222

Browse files
Merge pull request geekcomputers#58 from kalisetti/master
A simple script to invoke webcam on your pc
2 parents 6d2c0cc + c17163d commit 8b18222

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: webcam.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import numpy as np
2+
import cv2
3+
4+
cap = cv2.VideoCapture(0)
5+
6+
while(True):
7+
# Capture frame-by-frame
8+
ret, frame = cap.read()
9+
10+
# Our operations on the frame come here
11+
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
12+
13+
# Display the resulting frame
14+
cv2.imshow('frame',gray)
15+
if cv2.waitKey(1) & 0xFF == ord('q'):
16+
break
17+
18+
# When everything done, release the capture
19+
cap.release()
20+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)