Hue and Saturation#
若要調整影像中個別顏色的外觀,請使用 Color Adjustment 功能(若可用)。
使用功能#
調整色相#
調整色相會改變影像的顏色。這在某些情況下可能很有用,例如用來校正顏色偏移,或是製作假色影像。
要調整色相:
- 若您的相機是 Basler dart 或 pulse 相機,請將像素格式設定為
YCbCr422-8或RGB8. - 為
BslHue參數(Dart 和 Pulse 攝影機:BslHueValue). 該參數的數值範圍為 -180° 至 180°。
該參數值代表 RGB 色彩立方體的旋轉角度。預設情況下,此參數設定為 0°(無色彩偏移)。
調整飽和度#
調整飽和度會改變顏色的鮮豔度(強度)。例如,較高的飽和度可使顏色更容易辨識。
要調整飽和度:
- 若您的相機是 Basler dart 或 pulse 相機,請將像素格式設定為
YCbCr422-8或RGB8. - 為
BslSaturation參數(Dart 和 Pulse 攝影機:BslSaturationValue) 。預設情況下,此參數設定為 1(正常飽和度)。
較低的參數值會產生較柔和且接近灰階的顏色。較高的參數值則會產生更生動、鮮明的顏色。
其他參數#
如果可用, BslHueRaw 進行明確的生命週期管理即呼叫 BslSaturationRaw 這些參數允許您為色相和飽和度參數輸入整數值,而非浮點數值。通常,您無需設定這些參數。
範例程式碼#
dart 與 pulse 相機#
/* 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);
其他相機#
/* 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);
您也可以 use the pylon Viewer 來輕鬆設定參數。