Newbie here. I am studying the OpenMV documentation and came upon the “sensor.get_rgb_gain_db()” method. The description reads, “Returns a tuple with the current camera red, green, and blue gain values in decibels ((float, float, float)).”
What exactly do “RGB gain values” mean?
Also, I tried implementing this in my simple code here:
# Hello World Example
# Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!
import sensor, image, time
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS.
clock.tick() # Update the FPS clock.
img = sensor.snapshot() # Take a picture and return the image.
print(sensor.get_rgb_gain_db()) # Note: OpenMV Cam runs about half as fast when connected
# to the IDE. The FPS should increase once disconnected.
And all I got was “(0.0, 0.0, 0.0)” repeatedly printed in my Serial Terminal.
Can anybody tell me what is wrong with my camera?
Thank you very much :))
If you have the OpenMV Cam H7 R2 we didn’t implement the method. On the H7 R1 it’s implemented.
Basically, white balance adjusts these values to make the RGB gains different. If you want to control white balance it’s important to save these values.
Thank you for your reply!
I have an OpenMV R2, so that makes sense.
If I wanted to use this method on the R2 to control the white balance, what can I do instead?
Uh, I’d read the sensor datasheets and manually do register reads and writes. The MT9M114 is like a SoC. It’s much more complex than the OV7725. As such it wasn’t possible for us to make this feature work.
Thank you for your response.
Manually doing register writes and reads sounds very difficult. Is there any other easy way for debugging the white balance?
Thank you very much.
Sorry, I didn’t implement it because it was too hard to do. Our API doesn’t map to the MT9M114.
So is there no way of controlling white balance on the R2?
See this document.
AND9572-D (MT9M114 RR).pdf (404.2 KB)
See the UVC white balance control.
However, it’s not clear at all how to control white balance on this camera chip. RGB gains are not exposed. Only the color temperature. This is why it’s not supported as it’s not clear what’s going on.
Thank you for sharing the document. I will look into it.
I understand that implementing the feature in the R2 was difficult on your side.
I will see what I can do with what I have.
Thank you, and have a nice day
Is there no way to stabilize the RGB gains on the R2 then? It’s making color detection a little iffy.
There’s likely a way. However, it’s not straightforward. Alex, did you find anything?