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

Hue and Saturation#

Hue and Saturation camera feature 允許您透過單一步驟調整影像中所有顏色的外觀。

若要調整影像中個別顏色的外觀,請使用 Color Adjustment 功能(若有提供)。

使用此功能#

調整色調#

調整色調會變更影像的顏色。這可用於校正色偏或建立假色影像。

若要調整色調:

  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(正常飽和度)。

較低的參數值會產生更接近灰階的柔和色彩。較高的參數值則會產生更鮮豔生動的色彩。

其他參數#

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