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

Light Source Preset (dart E)#

透過 Light Source Preset camera feature,您可以校正特定光源所造成的色偏。

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

使用此功能#

選擇 Light Source Preset#

若要選擇 Light Source Preset,請設定 LightSourcePreset 參數的值。

可用的 preset 取決於 BalanceWhiteAuto Property 設定。

  • 如果已啟用 BalanceWhiteAuto 參數已設定為 Continuous上, LightSourcePreset 參數已設定為 Auto,且 Light Source Preset 會自動決定。
  • 如果已啟用 BalanceWhiteAuto 參數已設定為 Off,可以使用下列 preset:

    • 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 Property 表示目前所選 Light Source Preset 的色溫。

此外,如果 Light Source Preset 設定為 Manual,此 Property 允許您手動設定色溫。

範例程式碼#

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