Hue and Saturation#
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:
- If your camera is a Basler dart or pulse camera, set the pixel format to
YCbCr422-8
orRGB8
. - 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:
- If your camera is a Basler dart or pulse camera, set the pixel format to
YCbCr422-8
orRGB8
. - 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#
/* 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#
/* 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.