Skip to content

Parameter names may not apply to your camera model.

To display appropriate parameter names, select a camera model:

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.

Info

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.

Using the Feature#

Configuring Color Transformation#

  1. Make sure the white balance is configured appropriately.
  2. Set the ProcessedRawEnable parameter to true (if available and if you're using a Bayer pixel format).
  3. Set the LightSourceSelector parameter to Custom (if available).
  4. Set the ColorTransformationValueSelector parameter to the desired position in the matrix, e.g., Gain00.
  5. 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.

Info

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.

ColorTransformationMatrixFactor Parameter

This parameter, which is only available on ace Classic/U/L cameras with GigE interface, determines the extent to which the color matrix influences the color values. If set to 0, the matrix is effectively disabled. Basler recommends leaving it at the default setting (1).

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.

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
CEnumParameter(nodemap, "ColorTransformationValueSelector").SetValue("Gain00");
// Enter a floating point value for the selected position
CFloatParameter(nodemap, "ColorTransformationValue").SetValue(1.5625);
// Select position Gain01 in the matrix
CEnumParameter(nodemap, "ColorTransformationValueSelector").SetValue("Gain01");
// Enter a floating point value for the selected position
CFloatParameter(nodemap, "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);
/* 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);
# Select position Gain00 in the matrix
camera.ColorTransformationValueSelector.Value = "Gain00"
# Enter a floating point value for the selected position
camera.ColorTransformationValue.Value = 1.5625
# Select position Gain01 in the matrix
camera.ColorTransformationValueSelector.Value = "Gain01"
# Enter a floating point value for the selected position
camera.ColorTransformationValue.Value = -0.4375

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

Select camera