MATRIX VISION - mvBlueCOUGAR-X/-XD Technical Documentation
Optimizing the color fidelity of the camera

Purpose of this chapter is to optimize the color image of a camera, so that it looks as natural as possible on different displays and for human vision.

This implies some linear and nonlinear operations (e.g. display color space or Gamma viewing LUT) which are normally not necessary or recommended for machine vision algorithms. A standard monitor offers, for example, several display modes like sRGB, "Adobe RGB", etc., which reproduce the very same color of a camera color differently.

It should also be noted that users can choose for either

  • camera based settings and adjustments or
  • host based settings and adjustments or
  • a combination of both.

Camera based settings are advantageous to achieve highest calculating precision, independent of the transmission bit depth, lowest latency, because all calculations are performed in FPGA on the fly and low CPU load, because the host is not invoked with these tasks. These camera based settings are

Host based settings save transmission bandwidth at the expense of accuracy or latency and CPU load. Especially performing gain, offset, and white balance in the camera while outputting RAW data to the host can be recommended.

Of course host based settings can be used with all families of cameras (e.g. also mvBlueFOX).

Host based settings are:

  • look-up table (LUTOperations)
  • color correction (ColorTwist)

The block diagram of the camera shows where the different settings can be found in the data flow of the image data.

To show the different color behaviors, we take a color chart as a starting point:

Figure 1: Color chart as a starting point

If we take a SingleFrame image without any color optimizations, an image can be like this:

Figure 2: SingleFrame snap without color optimization
Figure 3: Corresponding histogram of the horizontal white to black profile

As you can see,

  • saturation is missing,
  • white is more light gray,
  • black is more dark gray,
  • etc.
Note
You have to keep in mind that there are two types of images: the one generated in the camera and the other one displayed on the computer monitor. Up-to-date monitors offer different display modes with different color spaces (e.g. sRGB). According to the chosen color space, the display of the colors is different.

The following figure shows the way to a perfect colored image

Figure 4: The way to a perfect colored image

including these process steps:

  1. Do a Gamma correction (Luminance),
  2. make a White balance and
  3. Improve the Contrast.
  4. Improve Saturation, and use a "color correction matrix" for both
    1. the sensor and / or
    2. the monitor.

The following sections will describe the single steps in detail.

Step 1: Gamma correction (Luminance)

First of all, a Gamma correction (Luminance) can be performed to change the image in a way how humans perceive light and color.

For this, you can change either

  • the exposure time,
  • the aperture or
  • the gain.

You can change the gain via wxPropView like the following way:

  1. Click on "Setting -> Base -> Camera -> GenICam -> LUT Control -> LUT Selector".
  2. Afterwards, click on "Wizard" to start the LUT Control wizard tool.
    The wizard will load the data from the camera.

    Figure 5: Selected LUT Selector and click on wizard will start wizard tool
    Figure 6: LUT Control
  3. Now, click on the "Gamma..." button
  4. and enter e.g. "2.2" as the Gamma value:

    Figure 7: Gamma Parameter Setup
  5. Then, click on "Copy to..." and select "All" and
  6. and click on "Enable All".
  7. Finally, click on Synchronize and play the settings back to the device (via "Cache -> Device").

    Figure 8: Synchronize

After gamma correction, the image will look like this:

Figure 9: After gamma correction
Figure 10: Corresponding histogram after gamma correction
Note
As mentioned above, you can do a gamma correction via ("Setting -> Base -> ImageProcessing -> LUTControl"). Here, the changes will affect the 8 bit image data and the processing needs the CPU of the host system:

Figure 11: LUTControl dialog

Just set "LUTEnable" to "On" and adapt the single LUTs like (LUT-0, LUT-1, etc.).

Step 2: White Balance

As you can see in the histogram, the colors red and blue are above green. Using green as a reference, we can optimize the white balance via "Setting -> Base -> Camera -> GenICam -> Analog Control -> Balance Ratio Selector" ("Balance White Auto" has to be "Off"):

  1. Just select "Blue" and
  2. adjust the "Balance Ratio" value until the blue line reaches the green one.

    Figure 12: Optimizing white balance
  3. Repeat this for "Red".

After optimizing white balance, the image will look like this:

Figure 13: After white balance
Figure 14: Corresponding histogram after white balance

Step 3: Contrast

Still, black is more a darker gray. To optimize the contrast you can use "Setting -> Base -> Camera -> GenICam -> Analog Control -> Black Level Selector":

  1. Select "DigitalAll" and
  2. adjust the "Black Level" value until black seems to be black.

    Figure 15: Back level adjustment

The image will look like this now:

Figure 16: After adapting contrast
Figure 17: Corresponding histogram after adapting contrast

Step 4: Saturation and Color Correction Matrix (CCM)

Still saturation is missing. To change this, the "Color Transformation Control" can be used ("Setting -> Base -> Camera -> GenICam -> Color Transformation Control"):

  1. Click on "Color Transformation Enable" and
  2. click on "Wizard" to start the saturation via "Color Transformation Control" wizard tool (since firmware version 1.4.57).

    Figure 18: Selected Color Transformation Enable and click on wizard will start wizard tool
  3. Now, you can adjust the saturation e.g. "1.1".

    Figure 19: Saturation Via Color Transformation Control dialog
  4. Afterwards, click on "Enable".
  5. Since driver version 2.2.2, it is possible to set the special color correction matrices at
    1. the input (sensor),
    2. the output side (monitor) and
    3. the saturation itself using this wizard.
  6. Select the specific input and output matrix and
  7. click on "Enable".
  8. As you can see, the correction is done by the host by default ("Host Color Correction Controls"). However, you can decide, if the color correction is done by the device by clicking on "Write To Device And Switch Off Host Processing". The wizard will take the settings of the "Host Color Correction Controls" and will save it in the device.
  9. Finally, click on "Apply".

After the saturation, the image will look like this:

Figure 20: After adapting saturation
Figure 21: Corresponding histogram after adapting saturation
Note
As mentioned above, you can change the saturation and the color correction matrices via ("Setting -> Base -> ImageProcessing -> ColorTwist"). Here, the changes will affect the 8 bit image data and the processing needs the CPU of the host system:
Figure 22: ColorTwist dialog
Figure 23: Input and output color correction matrix