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
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.
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.
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 |
// 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.