opencv

 import cv2, time


#1. Create an object.zero for external camera
video=cv2.VideoCapture(0)

#8. a variable
a=0

while True:
    a=a+1

    #3.Create a frame object
    check, frame = video.read()

    print(check)
    print(frame) #Representing Img

    #6.converting to grayscale
    gray=cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    #4.show the frame
    cv2.imshow("capturing", frame)
    
    #5.press any key to out (milisecond)
#cv2.waitKey(0)

    #7.for playing
    key=cv2.waitKey(1)

    if key == ord('q'):
        break
print(a)

#2.shutdown camera
video.release()

cv2.destroyAllWindows


Comments

Popular Posts