Using On-Host Color Correction with Spinnaker

Applicable Products

Spinnaker v4.2

  • SpinView support for Windows
  • API support for Windows, Linux, and MacOS

Any camera using Spinnaker can access the color correction feature. There are preset profiles created for specific sensors but you are not limited to only using your camera’s sensor profile.

Camera
Family
On-camera
Color Correction
On-host
Color Correction
Blackfly N/A Supported
Blackfly S Supported Supported
Chameleon3 N/A Supported
Firefly Supported Supported
Forge 1GigE Supported Supported
Forge 5GigE N/A Supported
Genie Nano N/A Supported
Grasshopper3 N/A Supported
Lt Series N/A Supported
Oryx Supported Supported

This application note is for color correction done using the Spinnaker SDK. For on-camera color correction, see Using On-Camera Color Correction.

Overview of Color Correction

Color correction is the process of adjusting the colors displayed in the source image (captured image) to a corrected color target image (final view).

Reproducing accurate color is important in many applications such as inspecting or sorting products, where minor differences in color can affect the accuracy and reliability of results. It is particularly important in microscopy for samples involving color, such as an histology slide stained with hematoxylin and eosin (H and E). Accurate color ensures that images can be correctly analyzed and compared with previous samples. If color reproduction is unreliable there is the risk of important information being missed or misinterpreted.

Besides lighting, other factors that affect the color in an image include the sensor in the camera, the monitor and monitor settings used, presence of an IR filter, and camera settings such as white balance.

The supplied host-based and on-camera color correction matrix (CCM) adjustments are intended for use in color cameras that are equipped with an IR-cut filter in the optical path.  When a color camera is used under full spectrum illumination (such as outdoors during the day), without an IR-cut filter the longer wavelengths have a significant impact on the image produced, resulting in colors being washed out.  The supplied CCMs are not able to produce accurate colors under these conditions.

Understanding Light Source Temperatures

Every sensor has a particular response to lighting and each lighting condition (for example: daylight, fluorescent light, LED) has its own emission spectrum which affects how the image appears when captured. The sensor’s efficiency at converting photons into electrons is measured as quantum efficiency (QE) and varies depending on the wavelength. Color correction takes into account how each color channel interacts with the others, and scales each color channel dependently. 

Most light sources indicate their actual or correlated color temperature measured in Kelvin (K).

While counterintuitive, "cooler" light sources that give off a blueish light have a higher color temperature while "warmer" light sources that give off a yellowish light have a lower color temperature.

Lighting Source Temperature in Kelvin
Incandescent 2765
Tungsten 2800
Warm Fluorescent 3000
Halogen 3188
Cool Fluorescent 4000
LED 4649
LED H and E 4649
Fluorescent 4665
Sunny 5000
Daylight 5034
Daylight H and E 5034
Cloudy 6500
Shade 8000

White Balance

White balance adjusts the camera’s response to the emission spectrum by applying a color channel gain level to each R, G, or B channel independently. A color correction matrix is a diagonal matrix that scales the individual target RGB values by a constant from their source RGB values.

How to Setup for On-host Color Correction

Step 1 Step 2 Step 3 Step 4
Hardware Configuration Adjust Camera Settings
(with Light only)
Apply Color Correction
(with sample)
Additional Camera Settings

Step 1—Hardware Configuration 

Before applying the color correction completely set up your imaging environment. The configuration of the hardware components of the system can influence the output.

  • Camera—different sensors have different sensitivities to light and color reproduction. The choice of camera affects the quality of the color in the final image.
  • Filters—many color cameras have a built-in Infrared Filter. Filters may also be inserted in microscope systems to influence spectrum produced by the light source.
  • Optics—the camera’s lens, or the lenses in the microscope, must be configured to produce the optimum image.
  • Light source—as well as the temperature described above, light sources can have different spectral properties that produce different results.
  • Monitor—color reproduction varies between monitors and monitors have settings that can affect the color represenation. Always calibrate your monitor before using and verfiy the calibration regularly.

Step 2—Adjust Camera Settings

Next, adjust your camera settings as necessary for your application. Do these adjustments with no sample in the scene so the settings are calibrated for your light source.

This might include:

  • Gain - start low and adjust up as necessary. Too much gain may result in noise in the image.
  • Exposure - auto exposure is recommended to prevent saturation.
  • Frame rate - increasing the exposure time may lower frame rate. 

When the image is properly exposed, use the auto white balance or manually adjust the Red, Green, and Blue color channels to achieve a white balance for the light source. Once calibrated, turn auto white balance off so that putting a sample in the scene does continuously change the color channels. See Using White Balance with Spinnaker for more guidance on white balance.

Step 3—Apply Color Correction

Note: some cameras have a color correction feature in their firmware, known as on-board CCM. This must be disabled to use the on-host color correction feature in the Spinnaker software.

In SpinView, on the Processing tab, deselect Color Transformation Enable.

On-board.png

With a sample in your scene, apply the on-host color correction using either a preset profile or by creating a manual profile as described below.

Step 4—Apply Additional Camera Settings

After the color correction is applied, additional adjustments to camera settings may include: gamma, saturation, contrast, hue, or brightness.

Note: if applying gamma in your system setup, do not turn Color Space on during color correction.

Preset Profiles

The following tables show the possible configuration combinations.

Microscopy Application / Linear Type
Light
Sources
Sensors MP Sensor Size Pixel Size
Incandescent Halogen
LED (default) Fluorescent Daylight
IMX226 12.0 1/1.7” 1.85
IMX249 2.3 1/1.2” 5.86
IMX250 5.0 2/3” 3.45
IMX252 3.2 1/1.8” 3.45
IMX253 12.3 1.1” 3.45
IMX255 8.9 1” 3.45
IMX264 5.0 2/3” 3.45
IMX265 3.2 1/1.8” 3.45
IMX267 8.9 1” 3.45
IMX273 1.6 1/2.9” 3.45
IMX287 0.4 1/2.9” 6.9
IMX296 1.6 1/2.9” 3.45
IMX297 0.4 1/2.9” 6.9
IMX304 12.3 1.1” 3.45
IMX327 2.1 1/2.8” 2.9
IMX334 8.2 1/1.8” 2
IMX342 31.4 APS-C 3.45
IMX367 19.6 4/3” 3.45
IMX387 16.8 4/3” 3.45
IMX392 2.3 1/2.3” 3.45
IMX420 7.1 1.1” 4.5
IMX421 2.8 2/3” 4.5
IMX422 2.0 1/1.7” 4.5
IMX425 1.7 1.1” 9
IMX428 7.1 1.1” 4.5
IMX429 2.8 2/3” 4.5
IMX430 2.0 1/1.7 4.5
Microscopy Application / Linear Type
Light
Sources
Sensors MP Sensor Size Pixel Size
LED H and E Daylight H and E IMX226 12.0 1/1.7” 1.85
IMX327 2.1 1/2.8” 2.9
IMX334 8.2 1/1.8” 2
IMX420 7.1 1.1” 4.5
IMX421 2.8 2/3” 4.5
IMX422 2.0 1/1.7” 4.5
IMX425 1.7 1.1” 9
IMX428 7.1 1.1” 4.5
IMX429 2.8 2/3” 4.5
IMX430 2.0 1/1.7 4.5
Generic Application / Linear Type
Light
Sources
Sensors MP Sensor Size Pixel Size
Tungsten
Warm Fluorescent Cool Fluorescent Sunny
Cloudy
Shade
General
IMX250 5.0 2/3” 3.45
Generic Application / Advanced Type
Light
Sources
Sensors MP Sensor Size Pixel Size
Tungsten
Warm Fluorescent
Cool Fluorescent Sunny
Cloudy
Shade
General
IMX250 5.0 2/3” 3.45
IMX252 3.2 1/1.8” 3.45
IMX253 12.3 1.1” 3.45
IMX255 8.9 1” 3.45
IMX264 5.0 2/3” 3.45
IMX265 3.2 1/1.8” 3.45

Using Color Correction

Using a Preset Profile

  1. Open SpinView and select your camera.
  2. Click the Color Correction icon, or right click and select Configure Color Correction. CCM-Icon.png
  3. From the Profiles, select Preset. This is the default setting.
    CCM-Preset.png
  4. From the Application drop-down select either:
  • Microscopy—use for microscope systems
  • Generic—use for any other application
  1. The Sensor drop-down is preselected to the current sensor of the camera. This is the best choice to start from.
  2. From the Color Temperature drop-down, select the light source. Not all light sources work with all sensors and applications. See the profiles above for different combinations.
  3. Select the Color Space, either:
  • On—applies a 2.2 gamma correction. Note: if you have set a gamma value independently, it is also applied.
  • Off —does not change the gamma.
  1. Select the Type, either:
  • Linear—use for 3x3 matrix
  • Advanced—use for 9x3 matrix

Not all configurations work with both types.

  1. Click Apply. This enables Color Correction, if not already enabled.

It is best to start from your current configuration of sensor and lighting, but if this does not suit your application experiment with other choices.

Creating a Manual Profile

If the preset configurations offered do not work for your application, you can create a manual one. This is recommended for expert users only.

  1. Open SpinView and select your camera.
  2. Click the Color Correction icon, or right click and select Configure Color Correction. CCM-Icon.png
  3. From the Profiles drop-down, select Manual.
    CCM-Custom.png
  4. From the Type drop-down, select either:
  • Linear (default)—use for 3x3 matrix
  • Advanced—use for 9x3 matrix
  • Custom—use to enter your own code, or open this type to copy the code created by the other two.
  1. Adjust the Matrix to create the profile.
  2. Click Apply.

Using the API

To get CCM example code, go to:

github.com/Teledyne-MV/Spinnaker-Examples/tree/main/AcquisitionCCM

Troubleshooting

I cannot access the color correction feature.

The on-host CCM feature can only be enabled if:

  • The camera is a color model.
  • The selected pixel format is a color format.
  • The on camera color correction is not enabled.

My camera’s sensor is not listed on the Sensor drop-down.

Not all sensors are supported with all applications. If your sensor is not on the list, try a sensor with similar traits (megapixels, sensor size, pixel size). See profiles above.

My light source is not listed on the Color Temperature drop-down.

Not all light sources are configured to work with all sensors for a given profile. To change the available light sources, try a different sensor or switch to a different application. See profiles above.

I’m getting an error that my configuration is not available.

Only certain combinations of application, sensor, light source, and type are supported. If you have created an unsupported configuration, adjust your settings.

I enabled Color Space but have more than 2.2 gamma correction.

The color space gamma of 2.2 is applied in addition to any gamma that has been enabled. To see if you have enabled additional gamma, go to Analog Control->Gamma Enable.

Related Articles