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

Hue and Saturation#

「Hue and Saturation 」相機功能讓您只需一個步驟,即可調整影像中所有顏色的外觀。

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

使用功能#

調整色相#

調整色相會改變影像的顏色。這在某些情況下可能很有用,例如用來校正顏色偏移,或是製作假色影像。

要調整色相:

  1. 若您的相機是 Basler dart 或 pulse 相機,請將像素格式設定為 YCbCr422-8 或 RGB8.
  2. 為 BslHue 參數(Dart 和 Pulse 攝影機: BslHueValue). 該參數的數值範圍為 -180° 至 180°。

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

調整飽和度#

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

要調整飽和度:

  1. 若您的相機是 Basler dart 或 pulse 相機,請將像素格式設定為 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

您也可以 use the pylon Viewer 來輕鬆設定參數。