Skip to content

Hue and Saturation#

The Hue and Saturation camera feature allows you to adjust the appearance of all colors in your images in a single step.

If you want to adjust the appearance of individual colors in your images, use the Color Adjustment feature (if available).

Using the Feature#

Adjusting the Hue#

Adjusting the hue shifts the colors of the image. This can be useful, e.g., to correct color shifts or to create false-color images.

To adjust the hue:

  1. If your camera is a Basler dart or pulse camera, set the pixel format to YCbCr422-8 or RGB8.
  2. Enter a value for the BslHue parameter (dart and pulse cameras: BslHueValue). The parameter's value range is -180° to 180°.

The parameter value refers to a rotation of the RGB color cube. By default, the parameter is set to 0° (no color shift).

Adjusting the Saturation#

Adjusting the saturation changes the colorfulness (intensity) of the colors. A higher saturation, for example, makes colors easier to distinguish.

To adjust the saturation:

  1. If your camera is a Basler dart or pulse camera, set the pixel format to YCbCr422-8 or RGB8.
  2. Enter a value for the BslSaturation parameter (dart and pulse cameras: BslSaturationValue) . By default, the parameter is set to 1 (normal saturation).

Lower parameter values result in more muted colors that are closer to gray. Higher parameter values result in more vivid, vibrant colors.

Additional Parameters#

If available, the BslHueRaw and BslSaturationRaw parameters allow you to enter integer values instead of float values for the hue and saturation parameters. Normally, you don't need to set these parameters.

Sample Code#

dart and pulse Cameras#

// Set the Hue parameter to 5 degrees
camera.BslHueValue.SetValue(5);
// Set the Saturation parameter to 1.4
camera.BslSaturationValue.SetValue(1.4);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Hue parameter to 5 degrees
CIntegerPtr(nodemap.GetNode("BslHueValue"))->SetValue(5);
// Set the Saturation parameter to 1.4
CFloatPtr(nodemap.GetNode("BslSaturationValue"))->SetValue(1.4);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Hue parameter to 5 degrees
CIntegerParameter(nodemap, "BslHueValue").SetValue(5);
// Set the Saturation parameter to 1.4
CFloatParameter(nodemap, "BslSaturationValue").SetValue(1.4);
// Set the Hue parameter to 5 degrees
camera.Parameters[PLCamera.BslHueValue].SetValue(5);
// Set the Saturation parameter to 1.4
camera.Parameters[PLCamera.BslSaturationValue].SetValue(1.4);
// Set the Hue parameter to 5 degrees
Pylon.DeviceSetIntegerFeature(hdev, "BslHueValue", 5);
// Set the Saturation parameter to 1.4
Pylon.DeviceSetFloatFeature(hdev, "BslSaturationValue", 1.4);
/* 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 */
/* Set the Hue parameter to 5 degrees */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslHueValue", 5);
CHECK(errRes);
/* Set the Saturation parameter to 1.4 */
errRes = PylonDeviceSetFloatFeature(hdev, "BslSaturationValue", 1.4);
CHECK(errRes);

Other Cameras#

// Set the Hue parameter to 5 degrees
camera.BslHue.SetValue(5);
// Set the Saturation parameter to 1.4
camera.BslSaturation.SetValue(1.4);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Hue parameter to 5 degrees
CIntegerPtr(nodemap.GetNode("BslHue"))->SetValue(5);
// Set the Saturation parameter to 1.4
CFloatPtr(nodemap.GetNode("BslSaturation"))->SetValue(1.4);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Hue parameter to 5 degrees
CIntegerParameter(nodemap, "BslHue").SetValue(5);
// Set the Saturation parameter to 1.4
CFloatParameter(nodemap, "BslSaturation").SetValue(1.4);
// Set the Hue parameter to 5 degrees
camera.Parameters[PLCamera.BslHue].SetValue(5);
// Set the Saturation parameter to 1.4
camera.Parameters[PLCamera.BslSaturation].SetValue(1.4);
// Set the Hue parameter to 5 degrees
Pylon.DeviceSetIntegerFeature(hdev, "BslHue", 5);
// Set the Saturation parameter to 1.4
Pylon.DeviceSetFloatFeature(hdev, "BslSaturation", 1.4);
/* 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 */
/* Set the Hue parameter to 5 degrees */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslHue", 5);
CHECK(errRes);
/* Set the Saturation parameter to 1.4 */
errRes = PylonDeviceSetFloatFeature(hdev, "BslSaturation", 1.4);
CHECK(errRes);

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