import numpy as np
import cv2 as cv

camera = cv.VideoCapture(0,cv.CAP_DSHOW) 

while True:
    hasFrame, frame = camera.read()
    if not hasFrame:
        break
    cv.imshow('camera',frame)
    key = cv.waitKey(10)
    if key == 27:
        break
    elif key == ord('s'):
        cv.imwrite('person.jpg',frame)

camera.release()
cv.destroyAllWindows()
