跳至內容
測試伺服器
開發伺服器

Hue and Saturation#

利用 Hue and Saturation 相機功能,您可以透過單一步驟調整影像中所有顏色的外觀。

如果您想要調整影像中個別顏色的外觀,請使用 Color Adjustment 功能(若適用)。

使用此功能#

調整 Hue#

調整色相會使影像的顏色產生偏移。這在校正色偏或建立偽色影像等情況下非常有用。

若要調整色相:

  1. 如果您的相機是 Basler dart 或 pulse 相機,請將 Pixel Format 設定為 YCbCr422-8 或 RGB8.
  2. 為 BslHue 參數(dart 和 pulse 相機: BslHueValue)。該參數的值域為 -180° 至 180°。

參數值代表 RGB 色彩立方體的旋轉。預設情況下,該參數設為 0°(無色偏)。

調整 Saturation#

調整飽和度會改變顏色的鮮豔度(強度)。例如,較高的飽和度可以使顏色更容易辨識。

若要調整飽和度:

  1. 如果您的相機是 Basler dart 或 pulse 相機,請將 Pixel Format 設定為 YCbCr422-8 或 RGB8.
  2. 為 BslSaturation 參數(dart 和 pulse 相機: BslSaturationValue)。預設情況下,該參數設為 1(正常飽和度)。

較低的參數值會產生較柔和、接近灰色的顏色。較高的參數值則會產生更鮮明、生動的顏色。

其他 Property#

如果可用, BslHueRaw 與 BslSaturationRaw 參數允許您輸入整數值,而不是浮點數值來設定色相和飽和度參數。通常情況下,您不需要設定這些參數。

範例程式碼#

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 來輕鬆設定參數。