Adjusting for dimmer lighting

2 posts / 0 new
Last post
Adjusting for dimmer lighting

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?

piborg's picture
Dealing with dim lighting

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, the default is 3.0. Making this larger has two potential issues:

  1. If it is too high it starts thinking that the black regions (walls and robots) are actually part of the track
  2. 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 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 to see how that is working. If the colour balance seems wrong you may wish to adjust the redGain, greenGain, and blueGain values in

A good way to check these settings is to set ImageProcessor.predatorView in 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.

Comment Images: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre>
  • Syntax highlight code surrounded by the <pre class="brush: lang">...</pre> tags, where lang is one of the following language brushes: bash, cpp, perl, python.
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Comment Images
Files must be less than 10 MB.
Allowed file types: png gif jpg jpeg.
Comment Attachments
Files must be less than 10 MB.
Allowed file types: txt pdf nfo doc docx rtf jpg png gif bmp zip tar gz csv xls.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.