1import numpy as np
2import cv2
3
4cap = cv2.VideoCapture(0)
5
6while(True):
7 # Capture frame-by-frame
8 ret, frame = cap.read()
9
10 # Display the resulting frame
11 cv2.imshow('frame',frame)
12
13 # Delay 1 milisecond everytime and check if pressed "q" to quit
14 if cv2.waitKey(1) & 0xFF == ord('q'):
15 break
16
17# When everything done, release the capture
18cap.release()
19cv2.destroyAllWindows()
20