Hi ,I am testing an OpenMV N6 for RoboCup Junior Soccer, and I am having several issues with camera configuration that I did not have before on an OpenMV H7.
I am trying to manually control white balance and also use brightness, contrast, and saturation adjustments, but on the N6 the behavior seems broken or ignored.
When I disable automatic white balance and try to use manual white balance, the configuration seems to apply only for a very short time, maybe less than one second or just a few frames, and then the camera image becomes completely black.
Also, when I print the values using sensor.get_rgb_gain_db(), I get:
-
first value:
-inf -
second value:
0.0 -
third value:
-inf
So it looks like red and blue become -inf, while green stays at 0.0.
I also tried changing the order of sensor initialization and configuration, but it did not help.
If I place sensor.skip_frames() before the white balance configuration, then manual white balance does not seem to apply at all. Auto white balance does get disabled, but the camera just keeps the last automatic state instead of using the manual values I want.
I also tried using:
-
sensor.set_brightness() -
sensor.set_contrast() -
sensor.set_saturation()
These settings are very useful for RoboCup Junior Soccer, but on the N6 they seem to be ignored no matter where I put them in the initialization sequence.
At least they do not throw an error, but they do not seem to change the image.
Initially, I tested a program that worked correctly on an OpenMV H7.
On the N6, the program runs, but:
-
white balance does not behave correctly
-
contrast, brightness, and saturation do not seem to change anything
import sensor
import time
import math
thresholds = [
(9, 49, 3, 127, 21, 127)
]
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.VGA)
sensor.set_auto_exposure(False, exposure_us=20000)
sensor.skip_frames(time=2000)
sensor.set_brightness(2)
sensor.set_contrast(2)
sensor.set_saturation(3)
sensor.set_auto_gain(False, gain_db=60) # must be turned off for color tracking
sensor.set_auto_whitebal(False,rgb_gain_db=(5.0,0.0,5.0)) # must be turned off for color tracking
clock = time.clock()
while True:
clock.tick()
img = sensor.snapshot()
for blob in img.find_blobs(thresholds, pixels_threshold=1, area_threshold=1, merge=True):
if blob.elongation() > 0.5:
img.draw_edges(blob.min_corners(), color=(255, 0, 0))
img.draw_line(blob.major_axis_line(), color=(0, 255, 0))
img.draw_line(blob.minor_axis_line(), color=(0, 0, 255))
img.draw_rectangle(blob.rect())
img.draw_cross(blob.cx(), blob.cy())
img.draw_keypoints(
[(blob.cx(), blob.cy(), int(math.degrees(blob.rotation())))], size=20).