跳转到内容

Gain Auto (dart E)#

相机的 Gain Auto 功能会在指定的限值内自动调整增益,直到达到目标亮度值为止。

如果要同时使用 Gain Auto 和 Exposure Auto,使用 Auto Function Profile 功能可以指定如何平衡两者效果。

要手动调整增益,请使用 Gain 功能。

该功能的使用#

启用或禁用 Gain Auto#

To enable or disable the Gain Auto auto function, set the GainAuto parameter to one of the following operating modes:

  • Continuous:相机在采集图像时连续调节增益。
  • Off:禁用自动功能 Gain Auto。增益保持为上次自动或手动调整后的值。

信息

  • 在 daA2500-60mc 相机上,启用或禁用 Gain Auto 时,同时也会启用或禁用 Exposure Auto。
  • 当相机连续拍摄图像时,自动功能会在经过较短的延迟后生效。前几张图像可能不受自动功能的影响。

指定上限#

信息

该功能仅适用于 daA…mci 相机。

自动功能会在指定限值范围内调整 Gain 参数值。

要更改上限,请将 AutoGainUpperLimit 参数设置为所需值(以 µs 为单位)。

在自动调节过程中,增益不会高于指定的限值范围。

指定目标亮度值#

信息

该功能仅适用于 daA…mci 相机。

自动功能会调整增益,直至达到目标亮度值(即平均灰度值)为止。

要指定目标值,请使用 AutoTargetBrightness 参数。

信息

  • 目标值计算不包括其他图像优化,例如 Gamma。根据设置的图像优化,相机输出的图像平均灰度值可能会明显低于或高于目标值。
  • 相机还使用 AutoTargetBrightness 参数来控制 Exposure Auto 自动功能。如果要同时使用 Gain Auto 和 Exposure Auto 功能,使用 Auto Function Profile 功能可以指定如何平衡两者效果。

示例代码#

// Set the the Gain Auto auto function to its maximum upper limit
double maxUpperLimit = camera.AutoGainUpperLimit.GetMax();
camera.AutoGainUpperLimit.SetValue(maxUpperLimit);
// Specify the target value
camera.AutoTargetBrightness.SetValue(0.6);
// Enable Gain Auto by setting the operating mode to Continuous
camera.GainAuto.SetValue(GainAuto_Continuous);
INodeMap& nodemap = camera.GetNodeMap();
// Set the the Gain Auto auto function to its maximum upper limit
double maxUpperLimit = CFloatParameter(nodemap, "AutoGainUpperLimit").GetMax();
CFloatParameter(nodemap, "AutoGainUpperLimit").SetValue(maxUpperLimit);
// Specify the target value
CFloatParameter(nodemap, "AutoTargetBrightness").SetValue(0.6);
// Enable Gain Auto by setting the operating mode to Continuous
CEnumParameter(nodemap, "GainAuto").SetValue("Continuous");
// Set the the Gain Auto auto function to its maximum upper limit
double maxUpperLimit = camera.Parameters[PLCamera.AutoGainUpperLimit].GetMaximum();
camera.Parameters[PLCamera.AutoGainUpperLimit].SetValue(maxUpperLimit);
// Specify the target value
camera.Parameters[PLCamera.AutoTargetBrightness].SetValue(0.6);
// Enable Gain Auto by setting the operating mode to Continuous
camera.Parameters[PLCamera.GainAuto].SetValue(PLCamera.GainAuto.Continuous);
/* 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 */
double maxUpperLimit = 0;
/* Set the the Gain Auto auto function to its maximum upper limit */
errRes = PylonDeviceGetFloatFeatureMax(hdev, "AutoGainUpperLimit", &maxUpperLimit);
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "AutoGainUpperLimit", maxUpperLimit);
CHECK(errRes);
/* Specify the target value */
errRes = PylonDeviceSetFloatFeature(hdev, "AutoTargetBrightness", 0.6);
CHECK(errRes);
/* Enable Gain Auto by setting the operating mode to Continuous */
errRes = PylonDeviceFeatureFromString(hdev, "GainAuto", "Continuous");
CHECK(errRes);
# Set the the Gain Auto auto function to its maximum upper limit
maxUpperLimit = camera.AutoGainUpperLimit.Max
camera.AutoGainUpperLimit.Value = maxUpperLimit
# Specify the target value
camera.AutoTargetBrightness.Value = 0.6
# Enable Gain Auto by setting the operating mode to Continuous
camera.GainAuto.Value = "Continuous"

You can also use the pylon Viewer to easily set the parameters.