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).
Adjusting the hue shifts the colors of the image. This can be useful, e.g., to correct minor, undesirable, color shifts or to create false-color images.
Adjusting the saturation changes the colorfulness (intensity) of the colors. Increasing the saturation can be useful to make colors easier to distinguish.
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:
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:
The following effects become apparent:
If the value range of the ColorAdjustmentHue parameter is -4.0 to 3.96875:
Decreasing the hue changes all red colors (i.e., colors with a predominantly red component) towards yellow.
Increasing the hue changes all red colors towards magenta.
If the value range of the ColorAdjustmentHue parameter is -1.0 to 1.0:
Increasing the hue changes all red colors (i.e., colors with a predominantly red component) towards yellow.
Decreasing the hue changes all red colors towards magenta.
Decreasing the saturation decreases the colorfulness of all red colors. At minimum, all red colors will be replaced by gray.
Increasing the saturation increases the colorfulness of all red colors. At maximum, all red colors are replaced by 100 % red.
Info
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.
Depending on your camera model, the following additional parameters are available:
ColorAdjustmentEnable: Enables or disables the Color Adjustment feature.
ColorAdjustmentReset command: Allows you to reset the color adjustment parameters to their initial values. This is especially useful if your adjustments haven't had the desired effect and you want to return quickly to the original settings.
ColorAdjustmentHueRaw: Allows you to enter integer values ranging from -128 to 127 for the hue parameter. The integer range maps linearly to the floating point range with -128 being equivalent to -4.0, 32 being equivalent to 1.0, and 127 being equivalent to 3.96875.
ColorAdjustmentSaturationRaw: Allows you to enter integer values ranging from 0 to 255 for the saturation parameter. The integer range maps linearly to the floating point range with 0 being equivalent to 0.0, 128 being equivalent to 1.0, and 255 being equivalent to 1.99219.
// Enable the Color Adjustment featurecamera.ColorAdjustmentEnable.SetValue(true);// Select red as the color to adjustcamera.ColorAdjustmentSelector.SetValue(ColorAdjustmentSelector_Red);// Enter a floating point value for the red huecamera.ColorAdjustmentHue.SetValue(-1.125);// Enter a floating point value for the red saturationcamera.ColorAdjustmentSaturation.SetValue(1.375);// Select cyan as the color to adjustcamera.ColorAdjustmentSelector.SetValue(ColorAdjustmentSelector_Cyan);// Enter an integer value for the cyan huecamera.ColorAdjustmentHueRaw.SetValue(-36);// Enter an integer value for the cyan saturationcamera.ColorAdjustmentSaturationRaw.SetValue(176);
INodeMap&nodemap=camera.GetNodeMap();// Enable the Color Adjustment featureCBooleanParameter(nodemap,"ColorAdjustmentEnable").SetValue(true);// Select red as the color to adjustCEnumParameter(nodemap,"ColorAdjustmentSelector").SetValue("Red");// Enter a floating point value for the red hueCFloatParameter(nodemap,"ColorAdjustmentHue").SetValue(-1.125);// Enter a floating point value for the red saturationCFloatParameter(nodemap,"ColorAdjustmentSaturation").SetValue(1.375);// Select cyan as the color to adjustCEnumParameter(nodemap,"ColorAdjustmentSelector").SetValue("Cyan");// Enter an integer value for the cyan hueCIntegerParameter(nodemap,"ColorAdjustmentHueRaw").SetValue(-36);// Enter an integer value for the cyan saturationCIntegerParameter(nodemap,"ColorAdjustmentSaturationRaw").SetValue(176);
// Enable the Color Adjustment featurecamera.Parameters[PLCamera.ColorAdjustmentEnable].SetValue(true);// Select red as the color to adjustcamera.Parameters[PLCamera.ColorAdjustmentSelector].SetValue(PLCamera.ColorAdjustmentSelector.Red);// Enter a floating point value for the red huecamera.Parameters[PLCamera.ColorAdjustmentHue].SetValue(-1.125);// Enter a floating point value for the red saturationcamera.Parameters[PLCamera.ColorAdjustmentSaturation].SetValue(1.375);// Select cyan as the color to adjustcamera.Parameters[PLCamera.ColorAdjustmentSelector].SetValue(PLCamera.ColorAdjustmentSelector.Cyan);// Enter an integer value for the cyan huecamera.Parameters[PLCamera.ColorAdjustmentHueRaw].SetValue(-36);// Enter an integer value for the cyan saturationcamera.Parameters[PLCamera.ColorAdjustmentSaturationRaw].SetValue(176);
/* Macro to check for errors */#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)GENAPIC_RESULTerrRes=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);
# Enable the Color Adjustment featurecamera.ColorAdjustmentEnable.Value=True# Select red as the color to adjustcamera.ColorAdjustmentSelector.Value="Red"# Enter a floating point value for the red huecamera.ColorAdjustmentHue.Value=-1.125# Enter a floating point value for the red saturationcamera.ColorAdjustmentSaturation.Value=1.375# Select cyan as the color to adjustcamera.ColorAdjustmentSelector.Value="Cyan"# Enter an integer value for the cyan huecamera.ColorAdjustmentHueRaw.Value=-36# Enter an integer value for the cyan saturationcamera.ColorAdjustmentSaturationRaw.Value=176
// Select red as the color to adjustcamera.BslColorAdjustmentSelector.SetValue(ColorAdjustmentSelector_Red);// Enter an integer value for the red huecamera.BslColorAdjustmentHue.SetValue(-1.125);// Enter an integer value for the red saturationcamera.BslColorAdjustmentSaturation.SetValue(1.375);
INodeMap&nodemap=camera.GetNodeMap();// Select red as the color to adjustCEnumParameter(nodemap,"BslColorAdjustmentSelector").SetValue("Red");// Enter an integer value for the red hueCFloatParameter(nodemap,"BslColorAdjustmentHue").SetValue(-1.125);// Enter an integer value for the red saturationCFloatParameter(nodemap,"BslColorAdjustmentSaturation").SetValue(1.375);
// Select red as the color to adjustcamera.Parameters[PLCamera.BslColorAdjustmentSelector].SetValue(PLCamera.ColorAdjustmentSelector.Red);// Enter an integer value for the red huecamera.Parameters[PLCamera.BslColorAdjustmentHue].SetValue(-1.125);// Enter an integer value for the red saturationcamera.Parameters[PLCamera.BslColorAdjustmentSaturation].SetValue(1.375);
/* Macro to check for errors */#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)GENAPIC_RESULTerrRes=GENAPI_E_OK;/* Return value of pylon methods *//* Select red as the color to adjust */errRes=PylonDeviceFeatureFromString(hdev,"BslColorAdjustmentSelector","Red");CHECK(errRes);/* Enter an integer value for the red hue */errRes=PylonDeviceSetFloatFeature(hdev,"BslColorAdjustmentHue",-1.125);CHECK(errRes);/* Enter an integer value for the red saturation */errRes=PylonDeviceSetFloatFeature(hdev,"BslColorAdjustmentSaturation",1.375);CHECK(errRes);
# Select red as the color to adjustcamera.BslColorAdjustmentSelector.Value="Red"# Enter an integer value for the red huecamera.BslColorAdjustmentHue.Value=-1.125# Enter an integer value for the red saturationcamera.BslColorAdjustmentSaturation.Value=1.375
// Select red as the color to adjustcamera.ColorAdjustmentSelector.SetValue(ColorAdjustmentSelector_Red);// Enter an integer value for the red huecamera.ColorAdjustmentHue.SetValue(-1.125);// Enter an integer value for the red saturationcamera.ColorAdjustmentSaturation.SetValue(1.375);
INodeMap&nodemap=camera.GetNodeMap();// Select red as the color to adjustCEnumParameter(nodemap,"ColorAdjustmentSelector").SetValue("Red");// Enter an integer value for the red hueCFloatParameter(nodemap,"ColorAdjustmentHue").SetValue(-1.125);// Enter an integer value for the red saturationCFloatParameter(nodemap,"ColorAdjustmentSaturation").SetValue(1.375);
// Select red as the color to adjustcamera.Parameters[PLCamera.ColorAdjustmentSelector].SetValue(PLCamera.ColorAdjustmentSelector.Red);// Enter an integer value for the red huecamera.Parameters[PLCamera.ColorAdjustmentHue].SetValue(-1.125);// Enter an integer value for the red saturationcamera.Parameters[PLCamera.ColorAdjustmentSaturation].SetValue(1.375);
/* Macro to check for errors */#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)GENAPIC_RESULTerrRes=GENAPI_E_OK;/* Return value of pylon methods *//* 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);
# Select red as the color to adjustcamera.ColorAdjustmentSelector.Value="Red"# Enter an integer value for the red huecamera.ColorAdjustmentHue.Value=-1.125# Enter an integer value for the red saturationcamera.ColorAdjustmentSaturation.Value=1.375