跳转到内容

Hue and Saturation#

相机的 Color Hexagon 功能可让您一步调整图像中所有颜色的外观。

如果要调整图像中所有颜色的外观,请使用 Color Adjustment 功能(如果有)。

该功能的使用#

调整色相#

调整色相偏移会改变图像的颜色。这对于纠正色彩偏移或创建伪彩图像等很有用。

要调整色相:

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

参数值是指 RGB 颜色立方体的旋转。默认情况下,该参数设置为 0°(无色彩偏移)。

调整饱和度#

调整饱和度会改变色彩的鲜艳程度(强度)。例如,较高的饱和度会使颜色更容易区分。

要调整饱和度:

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

较低的参数值会导致更接近灰色的更为柔和的颜色。较高的参数值会产生更鲜艳的色彩。

附加参数#

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.

示例代码#

dart 和 pulse 相机#
// 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
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);
/* 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);
# Set the Hue parameter to 5 degrees
camera.BslHueValue.Value = 5
# Set the Saturation parameter to 1.4
camera.BslSaturationValue.Value = 1.4
其他相机#
// 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
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);
/* 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);
# Set the Hue parameter to 5 degrees
camera.BslHue.Value = 5
# Set the Saturation parameter to 1.4
camera.BslSaturation.Value = 1.4

您也可以使用 pylon Viewer 轻松设置参数。