Color Transformation

The Color Transformation camera feature allows you to correct the color information delivered by the sensor.

Using a color transformation matrix, the feature can correct color shifts caused by the light source used during image acquisition as well as compensate for imperfections in the sensor’s color generation process.

You should only use this feature if you are thoroughly familiar with matrix color transformations. It is nearly impossible to enter correct values in the transformation matrix by trial and error.

In this topic Hide

Using the Feature

Prerequisites

Configuring Color Transformation

  1. Set the ColorTransformationValueSelector parameter to the desired position in the matrix, e.g., Gain00.
  2. Enter the desired value for the ColorTransformationValue parameter to adjust the value at the selected position. The parameter's value range is -8.0 to +7.96875.

The transformation matrix is already populated with color transformation values. They are related to previously selected light source presets, correspond to unit vectors, or result from a previous use of the color transformation feature.

How It Works

The color transformation feature uses a transformation matrix to deliver modified red, green, and blue pixel data for each pixel.

The transformation is performed by premultiplying a 3 x 1 matrix containing R, G, and B pixel values by a 3 x 3 matrix containing the color transformation values:

Color Transformation Matrix

You can set each matrix value (Gain00, Gain01, etc.) according to your requirements.

External Links

Specifics

Camera Model "Custom" Light Source Preset Available
Mono cameras Color Transformation feature not supported
All ace 2 GigE color cameras No

All ace 2 USB 3.0 color cameras

No
All ace GigE color cameras Yes
All ace USB 3.0 color cameras No

All boost CXP-12 color cameras

tbd

All dart BCON for LVDS color cameras Color Transformation feature not supported
All dart BCON for MIPI color cameras Color Transformation feature not supported
All dart USB 3.0 color cameras Color Transformation feature not supported
All pulse USB 3.0 color cameras Color Transformation feature not supported

Sample Code

// Select position Gain00 in the matrix
camera.ColorTransformationValueSelector.SetValue(ColorTransformationValueSelector_Gain00);
// Enter a floating point value for the selected position
camera.ColorTransformationValue.SetValue(1.5625);
// Select position Gain01 in the matrix
camera.ColorTransformationValueSelector.SetValue(ColorTransformationValueSelector_Gain01);
// Enter a floating point value for the selected position
camera.ColorTransformationValue.SetValue(-0.4375);
INodeMap& nodemap = camera.GetNodeMap();
// Select position Gain00 in the matrix
CEnumerationPtr(nodemap.GetNode("ColorTransformationValueSelector"))->FromString("Gain00");
// Enter a floating point value for the selected position
CFloatPtr(nodemap.GetNode("ColorTransformationValue"))->SetValue(1.5625);
// Select position Gain01 in the matrix
CEnumerationPtr(nodemap.GetNode("ColorTransformationValueSelector"))->FromString("Gain01");
// Enter a floating point value for the selected position
CFloatPtr(nodemap.GetNode("ColorTransformationValue"))->SetValue(-0.4375);
// Select position Gain00 in the matrix
camera.Parameters[PLCamera.ColorTransformationValueSelector].SetValue(PLCamera.ColorTransformationValueSelector.Gain00);
// Enter a floating point value for the selected position
camera.Parameters[PLCamera.ColorTransformationValue].SetValue(1.5625);
// Select position Gain01 in the matrix
camera.Parameters[PLCamera.ColorTransformationValueSelector].SetValue(PLCamera.ColorTransformationValueSelector.Gain01);
// Enter a floating point value for the selected position
camera.Parameters[PLCamera.ColorTransformationValue].SetValue(-0.4375);
// Select position Gain00 in the matrix
Pylon.DeviceFeatureFromString(hdev, "ColorTransformationValueSelector", "Gain00");
// Enter a floating point value for the selected position
Pylon.DeviceSetFloatFeature(hdev, "ColorTransformationValue", 1.5625);
// Select position Gain01 in the matrix
Pylon.DeviceFeatureFromString(hdev, "ColorTransformationValueSelector", "Gain01");
// Enter a floating point value for the selected position
Pylon.DeviceSetFloatFeature(hdev, "ColorTransformationValue", -0.4375);
/* Macro to check for errors */
#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)
GENAPIC_RESULT errRes = GENAPI_E_OK;  /* Return value of pylon methods */
/* Select position Gain00 in the matrix */
errRes = PylonDeviceFeatureFromString(hdev, "ColorTransformationValueSelector", "Gain00");
CHECK(errRes);
/* Enter a floating point value for the selected position */
errRes = PylonDeviceSetFloatFeature(hdev, "ColorTransformationValue", 1.5625);
CHECK(errRes);
/* Select position Gain01 in the matrix */
errRes = PylonDeviceFeatureFromString(hdev, "ColorTransformationValueSelector", "Gain01");
CHECK(errRes);
/* Enter a floating point value for the selected position */
errRes = PylonDeviceSetFloatFeature(hdev, "ColorTransformationValue", -0.4375);
CHECK(errRes);

You can also use the pylon Viewer to easily set the parameters.