exposure and gain control

Dear all,

As i use a small part of the image, i try to control the exposure and gain to have the highest contrast with different ambiant lights.

Is there a possibility to have the automatic gain and exposure control on a small part of the image ?
sensor.set_windowing((128,128)) only cut the image (white part is still white).

The gain is a float, and what is the minimum and maximum value (0.00001 to 9999.99999) ?
What about the exposure too (1 to 1960µs as said in OV7725 datasheet) ?

Thanks for help,

Hi, the camera doesn’t support gain/exposure for a small part of the image.

As for the min and maxes, the gain has a max of 32 or so. The exposure isn’t really limited by anything. But, if you set it very high the FPS will go to near 0. The exposure is based on the pixel readout line times which we can be quite large.

Um, in the latest firmware I’ve been working on you’ll be able to cut out an area of the image and then gamma adjust it in one line of code. Will this work for you? The gamma adjustment method can change gamma, contrast, and brightness in one go and is very fast.

I used to do long exposure astrophotography with modified webcams. We (the group that was into this) would perform circuit modifications of the webcam to enable manual control of the sensor shutter and then we could run very long exposures. I wrote pretty much the only and best (if I may say so) Mac software for controlling such modified cameras and for post-processing image stacks. Which all leads to my follow-up question in this thread. Are you really saying we have essentially long-exposure access to OpenMV simply by playing with the exposure setting? Can we leave the sensor exposing for seconds or even minutes? Just curious. I’ll have to play with it, but I’m tantalized.

The OV7725 has some digital hardware that blocks exposing forever, but, with the new global shutter sensor you can set the exposure to multiple seconds. Getting above minutes requires you to change the sensor clock freq which you can do if you edit the C firmware.

I already inquired about adding a global shutter module to my H7 preorder. I hope it all goes smoothly. :slight_smile: My initial project with the M7 has gone well, but I need more juice.

See: https://github.com/openmv/openmv/blob/master/src/omv/mt9v034.c#L324

It looks like I range limit the exposure to half a second. However, you can do the register writes yourself in python to bypass this.

See page 18 for the register documentation:

You’ll need to adjust the clock freq if you want to get really high exposure values. This is just a value in a header file however:

https://github.com/openmv/openmv/blob/master/src/omv/mt9v034.h#L12

Dear,

Thanks for your answer.

Yes gamma adjust seems to be like contrast adjust as well as i can understand, but latest firmware is for H7 because i use M7 up to i receive the H7 from kickstarter ?

Do you have an idea of the minimum of gain because it is a float and it could be very low but i am not sure if it is electronically possible ?

Thanks,

The latest firmware is for all camera versions.

The minimum gain is like 1/16th. It has fine steps of 1/16th and then large steps of 1 to 32.

lol, ok you mean the last current firmware.

I am not sure which function does this gamma correction.
Is it the function for histogram ?

Thanks,

Hi, no, I added a gamma correction method to the latest un-released firmware. I.e. what we are working on currently. It can do gamma, contrast, and brightness adjustment very fast. If this works for you I’ll post the binary along with an example script.

Are we able to achieve a relatively flat gamma curve? Flat gamma, while often not pleasing to the eye, is very helpful in analysis.

It’s a general gamma correction method. So, you can apply whatever gain you want. If you need feedback based on the image use the get histogram method and change the gamma correction based on the histogram.