Skip to content

Adjust the minimum exposure time

Instruction


On different system, the format of the uvc camera’s attribute information report is different. Such as exposure control.

  • On Window system,you will see the following correspondence.

Catch

Example:

import cv2

# open video0
cap = cv2.VideoCapture(0, cv2.CAP_MSMF)

# Turn off auto exposure
cap.set(cv2.CAP_PROP_AUTO_EXPOSURE, 1)
# set exposure time
cap.set(cv2.CAP_PROP_EXPOSURE, 0)

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()
    # Display the resulting frame
    cv2.imshow('frame', frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
  • On linux system, it throw out with another style. You can use v4l2-ctl tool to get more uvc camera’s informaton.
v4l2-ctl -l -d /dev/video0

CatchA8FD

We can see it support exposure_auto mode control and exposure_absolute control. and the control range is min=1,max = 5000, notice the unit 0.1ms.

For example, if we want to set the exposure to 1ms.

Firstly, You should open the cameara.

Then set the exposure_auto to manual mode using “v4l2-ctl -c exposure_auto=1” command.

Last set the exposure_absolute to 10 (10*0.1=1ms) using “v4l2-ctl -c exposure_absolute=10” command.