Color Transformation#
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#
Prerequisites#
- For color transformation to work properly, the white balance must be configured appropriately.
- If the Custom light source preset is available on your camera, it must be selected.
- If the ProcessedRawEnable parameter is available on your camera and if the pixel format is set to a Bayer format, the ProcessedRawEnable parameter must be set to true.
Configuring Color Transformation#
- Set the ColorTransformationValueSelector parameter to the desired position in the matrix, e.g., Gain00.
- 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.
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:
You can set each matrix value (Gain00, Gain01, etc.) according to your requirements.
External Links#
Specifics#
Camera Model | Custom Light Source Preset Available |
---|---|
a2A1920-51gcBAS | No |
a2A1920-51gmBAS | Color Transformation feature not supported |
a2A1920-160ucBAS | No |
a2A1920-160umBAS | Color Transformation feature not supported |
acA640-90gc | Yes |
acA640-90gm | Color Transformation feature not supported |
acA640-90uc | No |
acA640-90um | Color Transformation feature not supported |
acA640-120gc | Yes |
acA640-120gm | Color Transformation feature not supported |
acA640-120uc | No |
acA640-120um | Color Transformation feature not supported |
acA640-121gm | Color Transformation feature not supported |
acA640-300gc | Yes |
acA640-300gm | Color Transformation feature not supported |
acA640-750uc | No |
acA640-750um | Color Transformation feature not supported |
acA720-290gc | Yes |
acA720-290gm | Color Transformation feature not supported |
acA720-520uc | No |
acA720-520um | Color Transformation feature not supported |
acA780-75gc | Yes |
acA780-75gm | Color Transformation feature not supported |
acA800-200gc | Yes |
acA800-200gm | Color Transformation feature not supported |
acA800-510uc | No |
acA800-510um | Color Transformation feature not supported |
acA1280-60gc | Yes |
acA1280-60gm | Color Transformation feature not supported |
acA1300-22gc | Yes |
acA1300-22gm | Color Transformation feature not supported |
acA1300-30gc | Yes |
acA1300-30gm | Color Transformation feature not supported |
acA1300-30uc | No |
acA1300-30um | Color Transformation feature not supported |
acA1300-60gc | Yes |
acA1300-60gm | Color Transformation feature not supported |
acA1300-60gmNIR | Color Transformation feature not supported |
acA1300-75gc | Yes |
acA1300-75gm | Color Transformation feature not supported |
acA1300-200uc | No |
acA1300-200um | Color Transformation feature not supported |
acA1440-73gc | Yes |
acA1440-73gm | Color Transformation feature not supported |
acA1440-220uc | No |
acA1440-220um | Color Transformation feature not supported |
acA1600-20gc | Yes |
acA1600-20gm | Color Transformation feature not supported |
acA1600-20uc | No |
acA1600-20um | Color Transformation feature not supported |
acA1600-60gc | Yes |
acA1600-60gm | Color Transformation feature not supported |
acA1920-25gc | Yes |
acA1920-25gm | Color Transformation feature not supported |
acA1920-25uc | No |
acA1920-25um | Color Transformation feature not supported |
acA1920-40gc | Yes |
acA1920-40gm | Color Transformation feature not supported |
acA1920-40uc | No |
acA1920-40ucMED | No |
acA1920-40um | Color Transformation feature not supported |
acA1920-40umMED | Color Transformation feature not supported |
acA1920-48gc | Yes |
acA1920-48gm | Color Transformation feature not supported |
acA1920-50gc | Yes |
acA1920-50gm | Color Transformation feature not supported |
acA1920-150uc | No |
acA1920-150um | Color Transformation feature not supported |
acA1920-155uc | No |
acA1920-155ucMED | No |
acA1920-155um | Color Transformation feature not supported |
acA1920-155umMED | Color Transformation feature not supported |
acA2000-50gc | Yes |
acA2000-50gm | Color Transformation feature not supported |
acA2000-50gmNIR | Color Transformation feature not supported |
acA2000-165uc | No |
acA2000-165um | Color Transformation feature not supported |
acA2000-165umNIR | Color Transformation feature not supported |
acA2040-25gc | Yes |
acA2040-25gm | Color Transformation feature not supported |
acA2040-25gmNIR | Color Transformation feature not supported |
acA2040-35gc | Yes |
acA2040-35gm | Color Transformation feature not supported |
acA2040-55uc | No |
acA2040-55um | Color Transformation feature not supported |
acA2040-90uc | No |
acA2040-90um | Color Transformation feature not supported |
acA2040-90umNIR | Color Transformation feature not supported |
acA2040-120uc | No |
acA2040-120um | Color Transformation feature not supported |
acA2440-20gc | Yes |
acA2440-20gm | Color Transformation feature not supported |
acA2440-35uc | No |
acA2440-35ucMED | No |
acA2440-35um | Color Transformation feature not supported |
acA2440-35umMED | Color Transformation feature not supported |
acA2440-75uc | No |
acA2440-75ucMED | No |
acA2440-75um | Color Transformation feature not supported |
acA2440-75umMED | Color Transformation feature not supported |
acA2500-14gc | Color Transformation feature not supported |
acA2500-14gm | Color Transformation feature not supported |
acA2500-14uc | No |
acA2500-14um | Color Transformation feature not supported |
acA2500-20gc | Yes |
acA2500-20gcMED | Yes |
acA2500-20gm | Color Transformation feature not supported |
acA2500-20gmMED | Color Transformation feature not supported |
acA2500-60uc | No |
acA2500-60um | Color Transformation feature not supported |
acA3088-16gc | Yes |
acA3088-16gm | Color Transformation feature not supported |
acA3088-57uc | No |
acA3088-57um | Color Transformation feature not supported |
acA3800-10gc | Yes |
acA3800-10gm | Color Transformation feature not supported |
acA3800-14uc | No |
acA3800-14um | Color Transformation feature not supported |
acA4024-8gc | Yes |
acA4024-8gm | Color Transformation feature not supported |
acA4024-29uc | No |
acA4024-29um | Color Transformation feature not supported |
acA4096-11gc | Yes |
acA4096-11gm | Color Transformation feature not supported |
acA4096-30uc | No |
acA4096-30ucMED | No |
acA4096-30um | Color Transformation feature not supported |
acA4096-30umMED | Color Transformation feature not supported |
acA4096-40uc | No |
acA4096-40ucMED | No |
acA4096-40um | Color Transformation feature not supported |
acA4096-40umMED | Color Transformation feature not supported |
acA4112-8gc | Yes |
acA4112-8gm | Color Transformation feature not supported |
acA4112-20uc | No |
acA4112-20ucMED | No |
acA4112-20um | Color Transformation feature not supported |
acA4112-20umMED | Color Transformation feature not supported |
acA4112-30uc | No |
acA4112-30ucMED | No |
acA4112-30um | Color Transformation feature not supported |
acA4112-30umMED | Color Transformation feature not supported |
acA4600-7gc | Yes |
acA4600-10uc | No |
acA5472-5gc | Yes |
acA5472-5gm | Color Transformation feature not supported |
acA5472-17uc | No |
acA5472-17um | Color Transformation feature not supported |
boA4096-93cc | tbd |
boA4096-93cm | Color Transformation feature not supported |
boA4112-68cc | tbd |
boA4112-68cm | Color Transformation feature not supported |
daA1280-54lc | Color Transformation feature not supported |
daA1280-54lm | Color Transformation feature not supported |
daA1280-54uc | Color Transformation feature not supported |
daA1280-54um | Color Transformation feature not supported |
daA1600-60lc | Color Transformation feature not supported |
daA1600-60lm | Color Transformation feature not supported |
daA1600-60uc | Color Transformation feature not supported |
daA1600-60um | Color Transformation feature not supported |
daA1920-15um | Color Transformation feature not supported |
daA1920-30uc | Color Transformation feature not supported |
daA1920-30um | Color Transformation feature not supported |
daA2500-14lc | Color Transformation feature not supported |
daA2500-14lm | Color Transformation feature not supported |
daA2500-14uc | Color Transformation feature not supported |
daA2500-14um | Color Transformation feature not supported |
daA2500-60mc | Color Transformation feature not supported |
puA1280-54uc | Color Transformation feature not supported |
puA1280-54um | Color Transformation feature not supported |
puA1600-60uc | Color Transformation feature not supported |
puA1600-60um | Color Transformation feature not supported |
puA1920-30uc | Color Transformation feature not supported |
puA1920-30um | Color Transformation feature not supported |
puA2500-14uc | Color Transformation feature not supported |
puA2500-14um | 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);
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);
// 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.