Skip to content

Commit 8efa84c

Browse files
added new file to get live video from webcam
1 parent d9285e0 commit 8efa84c

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import cv2
2+
3+
# cv2 method to capture frames from live video
4+
cap = cv2.VideoCapture(0)
5+
6+
# loop to get frames
7+
while(1):
8+
9+
# read every frame from
10+
ret, videoframe = cap.read()
11+
12+
# Display the frame
13+
cv2.imshow('Camera',videoframe)
14+
15+
# delay
16+
if cv2.waitKey(1) & 0xFF == ord('q'):
17+
break
18+
19+
# camera realesing
20+
cap.release()
21+
22+
# destroying all windows
23+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)