I'm running a test track in my basement and the lighting is not as bright as the official track. What's the best way to adjust the gains on the CV to compensate for dimmer light?
Lower light levels can be tricky, in particular the amount of noise in the image tends to increase. The worst thing for the processing is shadows, a low but consistent light will be better than having bright or dark spots on the track.
The first thing to try would be increasing the limiter on the automatic brightness correction. The value is called autoGainMax in Settings.py, the default is 3.0. Making this larger has two potential issues:
If it is too high it starts thinking that the black regions (walls and robots) are actually part of the track
It works based on the largest value seen, this means it does not correct very well for shadows
Another option would be to reduce the black levels so that darker values are still identified as part of the track. This can be done by lowering the values for blackMaxR, blackMaxG, and blackMaxB in Settings.py. The levels are tested just after the simple auto-gain mentioned above. A pixel is identified as black when it is below all three levels at once.
The actual colour comparisons for the lanes should automatically compensate for the differences in light levels. See the calculations for autoGainR, autoGainG, and autoGainB in ImageProcessor.py to see how that is working. If the colour balance seems wrong you may wish to adjust the redGain, greenGain, and blueGain values in Settings.py.
A good way to check these settings is to set ImageProcessor.predatorView in Formula.py to True and take a look at where the processing sees the lane colours. The black regions are shown as pure white, each lane is displayed using only red, green, or blue for how it has been identified. There are some examples of how it should look when working correctly below.
Lower light levels can be tricky, in particular the amount of noise in the image tends to increase. The worst thing for the processing is shadows, a low but consistent light will be better than having bright or dark spots on the track.
The first thing to try would be increasing the limiter on the automatic brightness correction. The value is called
autoGainMax
inSettings.py
, the default is3.0
. Making this larger has two potential issues:Another option would be to reduce the black levels so that darker values are still identified as part of the track. This can be done by lowering the values for
blackMaxR
,blackMaxG
, andblackMaxB
inSettings.py
. The levels are tested just after the simple auto-gain mentioned above. A pixel is identified as black when it is below all three levels at once.The actual colour comparisons for the lanes should automatically compensate for the differences in light levels. See the calculations for
autoGainR
,autoGainG
, andautoGainB
inImageProcessor.py
to see how that is working. If the colour balance seems wrong you may wish to adjust theredGain
,greenGain
, andblueGain
values inSettings.py
.A good way to check these settings is to set
ImageProcessor.predatorView
inFormula.py
toTrue
and take a look at where the processing sees the lane colours. The black regions are shown as pure white, each lane is displayed using only red, green, or blue for how it has been identified. There are some examples of how it should look when working correctly below.Add new comment