Apply Fixed Camera Sensor Settings

Hi, I’m currently working on image differencing and occasional strong light source as well as the casted shadow of objects are interfering with the results. I’m trying to combat these by applying a fixed settings to the camera sensors to the time when the reference image has been taken.

I made a script to try to achieve that but at runtime the white colour was overexposed after the fixed settings had been set. Do you have any idea or do you spot any mistake in the code? please find attached the script and some screenshots of the results I got from it.

By the way do you have any recommendation to deal with the stated issue in frame differencing? Thanks in advance.

manual_mode.zip (965 Bytes)


You have to do this. It’s the BLC control still running: Method for Full Manual Mode for Sensor OV7725 · Issue #887 · openmv/openmv · GitHub

As for the strong light… you should only apply frame differencing in applications where you control the environment. If a strong light appears you have to change the reference image.

Thanks for the help, I’ll look into the link. About the strong light, do we have something already available to detect strong light source from just the image of the camera sensor? By the way, do you also have any recommendation in dealing with casted shadow in frame differencing?

Hi regarding the shadow. We’ve had customers try to deal with this before. There’s no good solution. Use a different approach if you are dealing with shadows. Frame differencing will fail you. I researched shadow removal heavily… methods to do so aren’t usable.

As for detecting a strong light source. Yes, you can use get_stats() to get the amount of light a region of interest on the image.

Thanks a lot, I think I know how to continue from here. I’m really appreciated for your helpful response. Have a great day!

Cool, just to be clear, we spent ALOT of time on shadow removal code… and got nowhere.

1 Like

so I followed the guide from your provided link and looked up the documentation also to try fixing the camera sensor settings with the settings when the camera started in auto mode. After retrieving the settings and setting it back with auto mode to False, the image still looked kind of over-exposed and the white balance was somewhat inaccurate. I manually fine-tuned exposure_us and rgb_gain values and got the image to look quite similar to how it is in auto mode, but it’s still not exactly the same of course. Could you please have a look at the code I attached? I presumed the way these these values were returned and the way they were set were not identical. I’m using the OpenMV H7+ board, which has the OV5640 with OpenMV3.9.2 firmware.
manual_mode (1).py (3.0 KB)

Hi, I don’t have the bandwidth to check your code exactly. However, you should just turn the autogain and exposure off after a few seconds.

It’s not really a great idea to fix the settings if you have to deal with a dynamic environment.