[참고]

 

[코드]

import cv2

capture = cv2.VideoCapture(0)
capture.set(cv2.CAP_PROP_AUTOFOCUS, 0)  # AUTOFOCUS 끄기

while True:
    has_frame, frame = capture.read()
    if not has_frame:
        print('Can\'t get frame')
        break
    
    cv2.imshow('frame', frame)
    key = cv2.waitKey(3)
    if key == 27:
        print('Pressed ESC')
        break

capture.release()
cv2.destroyAllWindows()

[설명]

  • 코드 한줄만 추가하면 됨
  • python의 간결함에 다시 한번 감탄함

+ Recent posts