Color Adjustment

The Color Adjustment camera feature allows you to adjust the hue and saturation of individual colors in your images.  

You can adjust hue and saturation separately for each primary and secondary color in the RGB color space (red, green, blue, yellow, cyan, and magenta).

If you want to adjust the appearance of all colors in a single step, use the Hue and Saturation feature (if available).

On ace 2 and boost cameras, all parameter names of this feature are prefixed with Bsl. Examples: BslColorAdjustmentEnable, BslColorAdjustmentSelector.

In this topic Hide

Using the Feature

Why Use Color Adjustment

Prerequisites

If the ColorAdjustmentEnable parameter is available, it must be set to true.

Setting the Color Adjustment Parameters

  1. Set the ColorAdjustmentSelector parameter to the desired color, e.g., Red.
  2. Enter the desired value for the ColorAdjustmentHue parameter. When the parameter is set to 0, the hue is not changed.
  3. Enter the desired value for the ColorAdjustmentSaturation parameter. When the parameter is set to 1, the saturation is not changed.

How it Works

The parameters of the Color Adjustment feature refer to the RGB color cube.

For easier visualization, the color cube can be projected onto a plane, resulting in a color hexagon:

RGB Color Cube Projected On a Plane

The primary colors (red, green, blue) and the secondary colors (yellow, cyan, magenta) are placed at the corners of this color hexagon.

You can adjust hue and saturation for each of these colors. This affects all areas in the image where the adjusted color predominates. For example, adjusting red affects the colors in the image with a predominantly red component.

The following diagram shows how changing hue and saturation of the color red affects the colors of your images:

Hue and Saturation Adjustment In the Color Hexagon. Adjustments Are Indicated for Red as an Example

The following effects become apparent:

When you adjust a color, the nearest neighboring colors in the color hexagon will also be affected to some degree. For example, when you adjust red, yellow and magenta will also be affected.

Additional Parameters

Depending on your camera model, the following additional parameters are available:

Specifics

Camera Model

Additional Parameters

Mono cameras

Color Adjustment feature not supported

All ace 2 GigE color cameras BslColorAdjustmentEnable
All ace 2 USB 3.0 color cameras BslColorAdjustmentEnable

All ace GigE color cameras

  • ColorAdjustmentEnablea

  • ColorAdjustmentReset

  • ColorAdjustmentHueRaw

  • ColorAdjustmentSaturationRaw

All ace USB 3.0 color cameras None

All boost CXP-12 color cameras

tbd

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

aIf the Processed Raw Enable feature is available and a Bayer pixel format is used, ProcessedRawEnable must be set to true. Otherwise, changes in the color adjustment parameters have no effect.

Sample Code

// Enable the Color Adjustment feature
camera.ColorAdjustmentEnable.SetValue(true);
// Select red as the color to adjust
camera.ColorAdjustmentSelector.SetValue(ColorAdjustmentSelector_Red);
// Enter a floating point value for the red hue
camera.ColorAdjustmentHue.SetValue(-1.125);
// Enter a floating point value for the red saturation
camera.ColorAdjustmentSaturation.SetValue(1.375);
// Select cyan as the color to adjust
camera.ColorAdjustmentSelector.SetValue(ColorAdjustmentSelector_Cyan);
// Enter an integer value for the cyan hue
camera.ColorAdjustmentHueRaw.SetValue(-36);
// Enter an integer value for the cyan saturation
camera.ColorAdjustmentSaturationRaw.SetValue(176);
// NOTE: On ace 2 and boost cameras, all parameters below must be prefixed with Bsl.
// Examples: BslColorAdjustmentSelector, BslColorAdjustmentHue.
// Select red as the color to adjust
camera.ColorAdjustmentSelector.SetValue(ColorAdjustmentSelector_Red);
// Enter an integer value for the red hue
camera.ColorAdjustmentHue.SetValue(-1.125);
// Enter an integer value for the red saturation
camera.ColorAdjustmentSaturation.SetValue(1.375);
INodeMap& nodemap = camera.GetNodeMap();
// Enable the Color Adjustment feature
CBooleanPtr(nodemap.GetNode("ColorAdjustmentEnable"))->SetValue(true);
// Select red as the color to adjust
CEnumerationPtr(nodemap.GetNode("ColorAdjustmentSelector"))->FromString("Red");
// Enter a floating point value for the red hue
CFloatPtr(nodemap.GetNode("ColorAdjustmentHue"))->SetValue(-1.125);
// Enter a floating point value for the red saturation
CFloatPtr(nodemap.GetNode("ColorAdjustmentSaturation"))->SetValue(1.375);
// Select cyan as the color to adjust
CEnumerationPtr(nodemap.GetNode("ColorAdjustmentSelector"))->FromString("Cyan");
// Enter an integer value for the cyan hue
CIntegerPtr(nodemap.GetNode("ColorAdjustmentHueRaw"))->SetValue(-36);
// Enter an integer value for the cyan saturation
CIntegerPtr(nodemap.GetNode("ColorAdjustmentSaturationRaw"))->SetValue(176);
// NOTE: On ace 2 and boost cameras, all parameters below must be prefixed with Bsl.
// Examples: BslColorAdjustmentSelector, BslColorAdjustmentHue.
// Select red as the color to adjust
CEnumerationPtr(nodemap.GetNode("ColorAdjustmentSelector"))->FromString("Red");
// Enter an integer value for the red hue
CFloatPtr(nodemap.GetNode("ColorAdjustmentHue"))->SetValue(-1.125);
// Enter an integer value for the red saturation
CFloatPtr(nodemap.GetNode("ColorAdjustmentSaturation"))->SetValue(1.375);
// Enable the Color Adjustment feature
camera.Parameters[PLCamera.ColorAdjustmentEnable].SetValue(true);
// Select red as the color to adjust
camera.Parameters[PLCamera.ColorAdjustmentSelector].SetValue(PLCamera.ColorAdjustmentSelector.Red);
// Enter a floating point value for the red hue
camera.Parameters[PLCamera.ColorAdjustmentHue].SetValue(-1.125);
// Enter a floating point value for the red saturation
camera.Parameters[PLCamera.ColorAdjustmentSaturation].SetValue(1.375);
// Select cyan as the color to adjust
camera.Parameters[PLCamera.ColorAdjustmentSelector].SetValue(PLCamera.ColorAdjustmentSelector.Cyan);
// Enter an integer value for the cyan hue
camera.Parameters[PLCamera.ColorAdjustmentHueRaw].SetValue(-36);
// Enter an integer value for the cyan saturation
camera.Parameters[PLCamera.ColorAdjustmentSaturationRaw].SetValue(176);
// NOTE: On ace 2 and boost cameras, all parameters below must be prefixed with Bsl.
// Examples: BslColorAdjustmentSelector, BslColorAdjustmentHue.
// Select red as the color to adjust
camera.Parameters[PLCamera.ColorAdjustmentSelector].SetValue(PLCamera.ColorAdjustmentSelector.Red);
// Enter an integer value for the red hue
camera.Parameters[PLCamera.ColorAdjustmentHue].SetValue(-1.125);
// Enter an integer value for the red saturation
camera.Parameters[PLCamera.ColorAdjustmentSaturation].SetValue(1.375);
// Enable the Color Adjustment feature
Pylon.DeviceSetBooleanFeature(hdev, "ColorAdjustmentEnable", true);
// Select red as the color to adjust
Pylon.DeviceFeatureFromString(hdev, "ColorAdjustmentSelector", "Red");
// Enter a floating point value for the red hue
Pylon.DeviceSetFloatFeature(hdev, "ColorAdjustmentHue", -1.125);
// Enter a floating point value for the red saturation
Pylon.DeviceSetFloatFeature(hdev, "ColorAdjustmentSaturation", 1.375);
// Select cyan as the color to adjust
Pylon.DeviceFeatureFromString(hdev, "ColorAdjustmentSelector", "Cyan");
// Enter an integer value for the cyan hue
Pylon.DeviceSetIntegerFeature(hdev, "ColorAdjustmentHueRaw", -36);
// Enter an integer value for the cyan saturation
Pylon.DeviceSetIntegerFeature(hdev, "ColorAdjustmentSaturationRaw", 176);
// NOTE: On ace 2 and boost cameras, all parameters below must be prefixed with Bsl.
// Examples: BslColorAdjustmentSelector, BslColorAdjustmentHue.
// Select red as the color to adjust
Pylon.DeviceFeatureFromString(hdev, "ColorAdjustmentSelector", "Red");
// Enter an integer value for the red hue
Pylon.DeviceSetFloatFeature(hdev, "ColorAdjustmentHue", -1.125);
// Enter an integer value for the red saturation
Pylon.DeviceSetFloatFeature(hdev, "ColorAdjustmentSaturation", 1.375);
/* 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 */
/* Enable the Color Adjustment feature */
errRes = PylonDeviceSetBooleanFeature(hdev, "ColorAdjustmentEnable", 1);
CHECK(errRes);
/* Select red as the color to adjust */
errRes = PylonDeviceFeatureFromString(hdev, "ColorAdjustmentSelector", "Red");
CHECK(errRes);
/* Enter a floating point value for the red hue */
errRes = PylonDeviceSetFloatFeature(hdev, "ColorAdjustmentHue", -1.125);
CHECK(errRes);
/* Enter a floating point value for the red saturation */
errRes = PylonDeviceSetFloatFeature(hdev, "ColorAdjustmentSaturation", 1.375);
CHECK(errRes);
/* Select cyan as the color to adjust */
errRes = PylonDeviceFeatureFromString(hdev, "ColorAdjustmentSelector", "Cyan");
CHECK(errRes);
/* Enter an integer value for the cyan hue */
errRes = PylonDeviceSetIntegerFeature(hdev, "ColorAdjustmentHueRaw", -36);
CHECK(errRes);
/* Enter an integer value for the cyan saturation */
errRes = PylonDeviceSetIntegerFeature(hdev, "ColorAdjustmentSaturationRaw", 176);
CHECK(errRes);
/* NOTE: On ace 2 and boost cameras, all parameters below must be prefixed with Bsl. */
/* Examples: BslColorAdjustmentSelector, BslColorAdjustmentHue. */
/* Select red as the color to adjust */
errRes = PylonDeviceFeatureFromString(hdev, "ColorAdjustmentSelector", "Red");
CHECK(errRes);
/* Enter an integer value for the red hue */
errRes = PylonDeviceSetFloatFeature(hdev, "ColorAdjustmentHue", -1.125);
CHECK(errRes);
/* Enter an integer value for the red saturation */
errRes = PylonDeviceSetFloatFeature(hdev, "ColorAdjustmentSaturation", 1.375);
CHECK(errRes);

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