Exposure setting issue with OpenCV in Python (microscope Dino Lite)

Hey guys, we have some issues with exposure setting. I have an USB microscope connected and we make pictures with OpenCV in Python. BUT we are trying to set exposure and it looks like it makes no change. Do you have any hint please?

cam_port = 1
cam = cv2.VideoCapture(cam_port)
cam.set(cv2.CAP_PROP_FRAME_WIDTH, 2592)
cam.set(cv2.CAP_PROP_FRAME_HEIGHT, 1944)
cam.set(cv2.CAP_PROP_AUTO_EXPOSURE, 0.25)
cam.set(cv2.CAP_PROP_EXPOSURE, -1)

Resolution settings works fine. We have tried to change values on AUTO_EXPOSURE (0, 0.25, 0.75, 1) and values on EXPOSURE like that and it makes no change. With this:


I get always -1.0 …
Our microscope is Dino Lite if it would make any difference I’m not suer…

Thank you!

which os / video backend / opencv version ?

Sorry for that.
It’s Windows 11, OpenCV
…about video backend - I am not sure which information exactly do you need (let say I’m quite new to the topic)

Sometimes the camera settings don’t work in a standard way, so OpenCV can’t handle it.
I recommend using the official SDK for the cameras. It offers full control over the camera settings.

Yeah thank you for your time. We have communicated with manufacturer in the past and there were not able to help us - altough they tried…

So we will try to find some other way :slight_smile:

Have a nice day.

try asking explicitly for either CAP_DSHOW or CAP_MSMF (apiPreference)

those backends don’t receive a lot of love. you can try to pop up a settings dialog by “setting” CAP_PROP_SETTINGS. if you’re lucky, you can mess with some settings there… and if you then get() them with OpenCV, hopefully they should be what you just entered in the GUI.

Hello Tulenimama,

Yes, the exposure control in most Dino-Lite models is not compatible with the UVC exposure standard. Since Q4 of 2021 EdgePLUS Dino-Lite models have been able to update their firmware to make the exposure control compatible with the UVC standard. If possible, please try an EdgePLUS model with firmware showing REV_0112 or higher in the hardware ID string. If not, please consider using the SDK.

EdgePLUS models can be identified with a ‘7’ as the 6th character in the part number, such as AM4917MZT.

Please contact your local distributor for instructions on how to update the firmware if necessary.

1 Like