跳转到内容
暂存服务器
开发服务器

Light Source Preset (dart E)#

相机的 Light Source Preset 功能可让您纠正部分光源引起的色彩偏移。

根据其特定的色温,用于图像采集的光源会导致图像中的色彩偏移。您可以通过选择相关的光源预设来纠正这些色彩偏移。

该功能的使用#

选择一种 Light Source Preset#

要选择 Light Source Preset,请设置 LightSourcePreset 参数的值。

可用的预设取决于 BalanceWhiteAuto 参数设置。

  • 如果 BalanceWhiteAuto 参数设置为 Continuous, LightSourcePreset 参数设置为 Auto,并且 Light Source Preset 将自动确定。
  • 如果 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 参数表示当前所选 Light Source Preset 的色温。

此外,如果将 Light Source Preset 设置为 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 轻松设置 parameter。