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

Light Source Preset (dart E)#

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

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

使用此功能#

選擇 Light Source Preset#

若要選擇光源預設,請設定 LightSourcePreset 參數來啟用它。

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

  • 如果 BalanceWhiteAuto 參數設定為 Continuous, LightSourcePreset 參數設定為 Auto,且光源預設會自動決定。
  • 如果 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 parameter 指示目前選定的光源預設的色溫。

此外,如果將光源預設設定為 Manual,此 parameter 允許您手動設定色溫。

範例程式碼#

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