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

Light Source Preset (dart E)#

使用 Light Source Preset camera feature,您可以校正由特定光源引起的色偏。

根據其特定的色溫,用於影像擷取的燈光可能會導致影像中出現色偏。您可以透過選擇相關的 Light Source Preset 來校正這些色偏。

使用功能#

選擇 Light Source Preset#

若要選擇 Light Source Preset,請將 LightSourcePreset 參數中選擇性地指定 HTML 記錄檔 (*.html) 的路徑與檔名。

可用的預設取決於 BalanceWhiteAuto 參數設定為何。

  • 若 buffer operator 的 BalanceWhiteAuto 參數設為 Continuous, LightSourcePreset 參數設為 Auto,且光源預設值會自動確定。
  • 若 buffer operator 的 BalanceWhiteAuto 參數設為 Off, 提供以下預設:

    • CoolWhiteFluorescent4250K: 相機會校正由色溫約為 4 250 K 的螢光燈所造成的色偏。
    • Daylight5000K:相機可校正由色溫約 5 000 K 的日光照明所引起的色偏。
    • Daylight6500K:相機可校正由色溫約 6 500 K 的日光照明所引起的色偏。
    • Daylight7500K: 相機會校正由色溫約為 7 500 K 的日光所造成的色偏。
    • Horizon2500K: 相機會校正由色溫約為 2 500 K 的地平線光源所造成的色彩偏移。
    • Manual: 色溫可進行設定 手動.
    • Tungsten2800K:相機可校正由色溫約 2 500 至 3 000 K 的鎢絲燈照明所引起的色偏。

取得或設定色溫#

當 BslLightSourceColorTemperature 此參數表示目前選取之光源預設值的色溫。

此外,如果光源預設值設定為 Manual, 此參數可讓您手動設定色溫。

範例程式碼#

// Set the light source preset to Daylight5000K
camera.LightSourcePreset.SetValue(LightSourcePreset_Daylight5000K);
// Get the color temperature of the currently selected light source preset
int64_t i = camera.BslLightSourceColorTemperature.GetValue();
// Set the light source preset to Manual
camera.LightSourcePreset.SetValue(LightSourcePreset_Manual);
// Manually set the color temperature
camera.BslLightSourceColorTemperature.SetValue(7334);
INodeMap& nodemap = camera.GetNodeMap();
// Set the light source preset to Daylight5000K
CEnumParameter(nodemap, "LightSourcePreset").SetValue("Daylight5000K");
// Get the color temperature of the currently selected light source preset
int64_t i = CIntegerParameter(nodemap, "BslLightSourceColorTemperature").GetValue();
// Set the light source preset to Manual
CEnumParameter(nodemap, "LightSourcePreset").SetValue("Manual");
// Manually set the color temperature
CIntegerParameter(nodemap, "BslLightSourceColorTemperature").SetValue(7334);
// Set the light source preset to Daylight5000K
camera.Parameters[PLCamera.LightSourcePreset].SetValue(PLCamera.LightSourcePreset.Daylight5000K);
// Get the color temperature of the currently selected light source preset
Int64 i = camera.Parameters[PLCamera.BslLightSourceColorTemperature].GetValue();
// Set the light source preset to Manual
camera.Parameters[PLCamera.LightSourcePreset].SetValue(PLCamera.LightSourcePreset.Manual);
// Manually set the color temperature
camera.Parameters[PLCamera.BslLightSourceColorTemperature].SetValue(7334);
/* 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 */
int64_t i = 0;
/* Set the light source preset to Daylight5000K */
errRes = PylonDeviceFeatureFromString(hdev, "LightSourcePreset", "Daylight5000K");
CHECK(errRes);
/* Get the color temperature of the currently selected light source preset */
errRes = PylonDeviceGetIntegerFeature(hdev, "BslLightSourceColorTemperature", &i);
CHECK(errRes);
/* Set the light source preset to Manual */
errRes = PylonDeviceFeatureFromString(hdev, "LightSourcePreset", "Manual");
CHECK(errRes);
/* Manually set the color temperature */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslLightSourceColorTemperature", 7334);
CHECK(errRes);
# Set the light source preset to Daylight5000K
camera.LightSourcePreset.Value = "Daylight5000K"
# Get the color temperature of the currently selected light source preset
i = camera.BslLightSourceColorTemperature.Value
# Set the light source preset to Manual
camera.LightSourcePreset.Value = "Manual"
# Manually set the color temperature
camera.BslLightSourceColorTemperature.Value = 7334

您也可以使用 pylon Viewer 輕鬆設定參數。