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:

print(cam.get(cv2.CAP_PROP_EXPOSURE))

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 4.6.0.66
ā€¦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