import cv2, time

video=cv2.VideoCapture(0)

a=1

while True:
    a=a+1
    check, frame = video.read()

    print(check)
    print(frame)

    gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
    #time.sleep(3)
    cv2.imshow("Capturing", gray)

    #key=cv2.waitKey(1000)   # 1 second intevals
    key=cv2.waitKey(1)      # 1 millisecond intervals

    #this is to break the loop with a "q" key (for quit)
    if key==ord('q'):
        break

print(a)

video.release()
cv2.destroyAllWindows()
import cv2, time

video=cv2.VideoCapture(0)

a=1

while True:
    a=a+1
    check, frame = video.read()

    print(check)
    print(frame)

    gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
    #time.sleep(3)
    cv2.imshow("Capturing", gray)

    #key=cv2.waitKey(1000)   # 1 second intevals
    key=cv2.waitKey(1)      # 1 millisecond intervals

    #this is to break the loop with a "q" key (for quit)
    if key==ord('q'):
        break

print(a)

video.release()
cv2.destroyAllWindows()
#time.sleep(3) #key=cv2.waitKey(1000)   # 1 second intevals # 1 millisecond intervals #this is to break the loop with a "q" key (for quit)