set gain ceiling

Discussion related to "under the hood" OpenMV topics.
User avatar
chrisPyres66
Posts: 144
Joined: Mon Jul 16, 2018 9:22 am
Location: France

set gain ceiling

Postby chrisPyres66 » Tue Jun 04, 2019 8:08 am

Dear all,

I try to understand how works the gain in the OV7725 camera, and i stopped on the gain ceiling.

To set the gain ceiling there is 2 ways in python :
- sensor.set_gainceiling(4)
- sensor.set_auto_gain(True, gain_db_ceiling=4)
which both write at the COM9 register but the c language codes do it in 2 different ways.

Here is the test code :

Code: Select all

import sensor
sensor.reset()                      # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 500)
sensor.set_gainceiling(4)
print("set_gainceiling : ", hex(sensor.__read_reg(0x14)))
sensor.set_auto_gain(True, gain_db_ceiling= 4)
print("set_auto_gain : ", hex(sensor.__read_reg(0x14)))
The result for 4db is ;
- set_gainceiling : 0x11 (this is right)
- set_auto_gain : 0x1 (this is not right)

Do i miss something ?
Thanks
User avatar
iabdalkader
Posts: 1142
Joined: Sun May 24, 2015 3:53 pm

Re: set gain ceiling

Postby iabdalkader » Tue Jun 04, 2019 9:58 am

set_gainceiling takes multipliers not db. So 4 means 4x the value is the max gain.
User avatar
chrisPyres66
Posts: 144
Joined: Mon Jul 16, 2018 9:22 am
Location: France

Re: set gain ceiling

Postby chrisPyres66 » Tue Jun 04, 2019 10:53 am

well, i see
- set_gainceiling : 2, 4, 8, 16 or 32 for x2, x4, x8, x16 or x32
- set_auto_gain : 2 to 32db

But i dont still understand teh relationship between gain and register ?
Thanks,
User avatar
iabdalkader
Posts: 1142
Joined: Sun May 24, 2015 3:53 pm

Re: set gain ceiling

Postby iabdalkader » Tue Jun 04, 2019 10:58 am

chrisPyres66 wrote:
Tue Jun 04, 2019 10:53 am
But i dont still understand teh relationship between gain and register ?
I think it's explained some where in an appnote.
User avatar
kwagyeman
Posts: 3829
Joined: Sun May 24, 2015 2:10 pm

Re: set gain ceiling

Postby kwagyeman » Tue Jun 04, 2019 12:21 pm

The ceiling is how much the auto algorithm goes up too.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests