Configuring camera properties in new OCV 2.4.3

后端 未结 3 2001
借酒劲吻你
借酒劲吻你 2021-01-15 06:38

I may just be googling wrong, but I cannot find out a way (read function) to change properties of camera in the new Open CV. I need to disable auto exposure

3条回答
  •  Happy的楠姐
    2021-01-15 07:06

    You can use the OpenCV API to do this using VideoCapture::Set(). Here is an example of how to set the exposure manually in Python:

    import cv2
    
    cap = cv2.VideoCapture(0)
    cap.set(cv2.CAP_PROP_EXPOSURE,-4)
    
    while(True):
        ret, frame = cap.read()
    
        cv2.imshow('frame',frame)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
    
    cap.release()
    cv2.destroyAllWindows()
    

    Here are the notes I have about the exposure time for each frame. Though I believe they are camera specific, they give you a good idea.

    -1  640 ms
    -2  320 ms
    -3  160 ms
    -4  80 ms
    -5  40 ms
    -6  20 ms
    -7  10 ms
    -8  5 ms
    -9  2.5 ms
    -10 1.25 ms
    -11 650 µs
    -12 312 µs
    -13 150 µs
    

    The same function has settings for GAIN and many other values, though I have not tried them.

    A bit more discussion at Setting Manual Exposure in OpenCV

提交回复
热议问题