跳转到内容

Exposure Auto#

相机的 Exposure Auto 功能会自动在指定限值内调整曝光时间,直到达到目标亮度为止。

自动功能的像素数据可以来自一个或多个自动功能 ROI

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

要手动调整曝光时间,请使用 Exposure Time 功能。

该功能的使用#

启用或禁用 Exposure Auto#

要启用或禁用 Exposure Auto 自动功能:

  1. 至少一个自动功能 ROI 分配给 Exposure Auto 自动功能。
    确保自动功能 ROI 部分或完全与图像 ROI 重叠。
  2. Set the ExposureMode parameter to Timed.
  3. 设置 ExposureAuto 参数设置为以下工作模式之一:
    • Once: The camera adjusts the exposure time until the specified target brightness value has been reached. When this has been achieved, or after a maximum of 30 calculation cycles, the camera sets the auto function to Off. To all following images, the camera applies the exposure time resulting from the last calculation.
    • Continuous: The camera adjusts the exposure time continuously while images are being acquired.
    • Off: Disables the Exposure Auto auto function. The exposure time remains at the value resulting from the last automatic or manual adjustment.

信息

当相机连续拍摄图像时,自动功能会在经过较短的延迟后生效。前几张图像可能不受自动功能的影响。

指定下限和上限#

The auto function adjusts the ExposureTime parameter value within limits specified by you.

To change the limits, set the AutoExposureTimeLowerLimit and the AutoExposureTimeUpperLimit parameters to the desired values (in µs).

Example: Assume you have set the AutoExposureTimeLowerLimit parameter to 1000 and the AutoExposureTimeUpperLimit parameter to 5000. During the automatic adjustment process, the exposure time will never be lower than 1000 µs and never higher than 5000 µs.

If the AutoExposureTimeUpperLimit parameter is set to a high value, the camera's frame rate may decrease.

指定目标亮度值#

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

To specify the target value, use the AutoTargetBrightness parameter.

信息

  • 目标值计算不包括其他图像优化,例如 Gamma。根据设置的图像优化,相机输出的图像平均灰度值可能会明显低于或高于目标值。
  • The camera also uses the AutoTargetBrightness parameter to control the Gain Auto auto function. If you want to use Exposure Auto and Gain Auto at the same time, use the Auto Function Profile feature to specify how the effects of both are balanced.
  • 在部分相机机型上,您可以使用 Remove Parameter Limits 功能提高目标值参数的上限。

在 Basler ace GigE 相机型号上,您还可以指定一个 Gray Value Adjustment Damping 系数。在 Basler dart 和 pulse 相机型号上,您可以指定 Brightness Adjustment Damping 系数。

如果使用阻尼系数,则达到目标值的速度会更慢。

示例代码#

ace Classic/U/L GigE 相机#
// Set the Exposure Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = camera.AutoExposureTimeLowerLimitRaw.GetMin();
double maxUpperLimit = camera.AutoExposureTimeUpperLimitRaw.GetMax();
camera.AutoExposureTimeLowerLimitRaw.SetValue(minLowerLimit);
camera.AutoExposureTimeUpperLimitRaw.SetValue(maxUpperLimit);
// Set the target brightness value to 128
camera.AutoTargetValue.SetValue(128);
// Select auto function ROI 1
camera.AutoFunctionAOISelector.SetValue(AutoFunctionAOISelector_AOI1);
// Enable the 'Intensity' auto function (Gain Auto + Exposure Auto)
// for the auto function ROI selected
camera.AutoFunctionAOIUsageIntensity.SetValue(true);
// Enable Exposure Auto by setting the operating mode to Continuous
camera.ExposureAuto.SetValue(ExposureAuto_Continuous);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Exposure Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = CFloatParameter(nodemap, "AutoExposureTimeLowerLimitRaw").GetMin();
double maxUpperLimit = CFloatParameter(nodemap, "AutoExposureTimeUpperLimitRaw").GetMax();
CFloatParameter(nodemap, "AutoExposureTimeLowerLimitRaw").SetValue(minLowerLimit);
CFloatParameter(nodemap, "AutoExposureTimeUpperLimitRaw").SetValue(maxUpperLimit);
// Set the target brightness value to 128
CIntegerParameter(nodemap, "AutoTargetValue").SetValue(128);
// Select auto function ROI 1
CEnumParameter(nodemap, "AutoFunctionAOISelector").SetValue("AOI1");
// Enable the 'Intensity' auto function (Gain Auto + Exposure Auto)
// for the auto function ROI selected
CBooleanParameter(nodemap, "AutoFunctionAOIUsageIntensity").SetValue(true);
// Enable Exposure Auto by setting the operating mode to Continuous
CEnumParameter(nodemap, "ExposureAuto").SetValue("Continuous");
// Set the Exposure Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = camera.Parameters[PLCamera.AutoExposureTimeLowerLimitRaw].GetMinimum();
double maxUpperLimit = camera.Parameters[PLCamera.AutoExposureTimeUpperLimitRaw].GetMaximum();
camera.Parameters[PLCamera.AutoExposureTimeLowerLimitRaw].SetValue(minLowerLimit);
camera.Parameters[PLCamera.AutoExposureTimeUpperLimitRaw].SetValue(maxUpperLimit);
// Set the target brightness value to 128
camera.Parameters[PLCamera.AutoTargetValue].SetValue(128);
// Select auto function ROI 1
camera.Parameters[PLCamera.AutoFunctionAOISelector].SetValue(PLCamera.AutoFunctionAOISelector.AOI1);
// Enable the 'Intensity' auto function (Gain Auto + Exposure Auto)
// for the auto function ROI selected
camera.Parameters[PLCamera.AutoFunctionAOIUsageIntensity].SetValue(true);
// Enable Exposure Auto by setting the operating mode to Continuous
camera.Parameters[PLCamera.ExposureAuto].SetValue(PLCamera.ExposureAuto.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 minLowerLimit = 0;
double maxUpperLimit = 0;
/* Set the Exposure Auto auto function to its minimum lower limit */
/* and its maximum upper limit */
errRes = PylonDeviceGetFloatFeatureMin(hdev, "AutoExposureTimeLowerLimitRaw", &minLowerLimit);
CHECK(errRes);
errRes = PylonDeviceGetFloatFeatureMax(hdev, "AutoExposureTimeUpperLimitRaw", &maxUpperLimit);
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "AutoExposureTimeLowerLimitRaw", minLowerLimit);
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "AutoExposureTimeUpperLimitRaw", maxUpperLimit);
CHECK(errRes);
/* Set the target brightness value to 128 */
errRes = PylonDeviceSetIntegerFeature(hdev, "AutoTargetValue", 128);
CHECK(errRes);
/* Select auto function ROI 1 */
errRes = PylonDeviceFeatureFromString(hdev, "AutoFunctionAOISelector", "AOI1");
CHECK(errRes);
/* Enable the 'Intensity' auto function (Gain Auto + Exposure Auto) */
/* for the auto function ROI selected */
errRes = PylonDeviceSetBooleanFeature(hdev, "AutoFunctionAOIUsageIntensity", 1);
CHECK(errRes);
/* Enable Exposure Auto by setting the operating mode to Continuous */
errRes = PylonDeviceFeatureFromString(hdev, "ExposureAuto", "Continuous");
CHECK(errRes);
# Set the Exposure Auto auto function to its minimum lower limit
# and its maximum upper limit
minLowerLimit = camera.AutoExposureTimeLowerLimitRaw.Min
maxUpperLimit = camera.AutoExposureTimeUpperLimitRaw.Max
camera.AutoExposureTimeLowerLimitRaw.Value = minLowerLimit
camera.AutoExposureTimeUpperLimitRaw.Value = maxUpperLimit
# Set the target brightness value to 128
camera.AutoTargetValue.Value = 128
# Select auto function ROI 1
camera.AutoFunctionAOISelector.Value = "AOI1"
# Enable the 'Intensity' auto function (Gain Auto + Exposure Auto)
# for the auto function ROI selected
camera.AutoFunctionAOIUsageIntensity.Value = True
# Enable Exposure Auto by setting the operating mode to Continuous
camera.ExposureAuto.Value = "Continuous"
其他相机#
// Set the Exposure Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = camera.AutoExposureTimeLowerLimit.GetMin();
double maxUpperLimit = camera.AutoExposureTimeUpperLimit.GetMax();
camera.AutoExposureTimeLowerLimit.SetValue(minLowerLimit);
camera.AutoExposureTimeUpperLimit.SetValue(maxUpperLimit);
// Set the target brightness value to 0.6
camera.AutoTargetBrightness.SetValue(0.6);
// Select auto function ROI 1
camera.AutoFunctionROISelector.SetValue(AutoFunctionROISelector_ROI1);
// Enable the 'Brightness' auto function (Gain Auto + Exposure Auto)
// for the auto function ROI selected
camera.AutoFunctionROIUseBrightness.SetValue(true);
// Enable Exposure Auto by setting the operating mode to Continuous
camera.ExposureAuto.SetValue(ExposureAuto_Continuous);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Exposure Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = CFloatParameter(nodemap, "AutoExposureTimeLowerLimit").GetMin();
double maxUpperLimit = CFloatParameter(nodemap, "AutoExposureTimeUpperLimit").GetMax();
CFloatParameter(nodemap, "AutoExposureTimeLowerLimit").SetValue(minLowerLimit);
CFloatParameter(nodemap, "AutoExposureTimeUpperLimit").SetValue(maxUpperLimit);
// Set the target brightness value to 0.6
CFloatParameter(nodemap, "AutoTargetBrightness").SetValue(0.6);
// Select auto function ROI 1
CEnumParameter(nodemap, "AutoFunctionROISelector").SetValue("ROI1");
// Enable the 'Brightness' auto function (Gain Auto + Exposure Auto)
// for the auto function ROI selected
CBooleanParameter(nodemap, "AutoFunctionROIUseBrightness").SetValue(true);
// Enable Exposure Auto by setting the operating mode to Continuous
CEnumParameter(nodemap, "ExposureAuto").SetValue("Continuous");
// Set the Exposure Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = camera.Parameters[PLCamera.AutoExposureTimeLowerLimit].GetMinimum();
double maxUpperLimit = camera.Parameters[PLCamera.AutoExposureTimeUpperLimit].GetMaximum();
camera.Parameters[PLCamera.AutoExposureTimeLowerLimit].SetValue(minLowerLimit);
camera.Parameters[PLCamera.AutoExposureTimeUpperLimit].SetValue(maxUpperLimit);
// Set the target brightness value to 0.6
camera.Parameters[PLCamera.AutoTargetBrightness].SetValue(0.6);
// Select auto function ROI 1
camera.Parameters[PLCamera.AutoFunctionROISelector].SetValue(PLCamera.AutoFunctionROISelector.ROI1);
// Enable the 'Brightness' auto function (Gain Auto + Exposure Auto)
// for the auto function ROI selected
camera.Parameters[PLCamera.AutoFunctionROIUseBrightness].SetValue(true);
// Enable Exposure Auto by setting the operating mode to Continuous
camera.Parameters[PLCamera.ExposureAuto].SetValue(PLCamera.ExposureAuto.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 minLowerLimit = 0;
double maxUpperLimit = 0;
/* Set the Exposure Auto auto function to its minimum lower limit */
/* and its maximum upper limit */
errRes = PylonDeviceGetFloatFeatureMin(hdev, "AutoExposureTimeLowerLimit", &minLowerLimit);
CHECK(errRes);
errRes = PylonDeviceGetFloatFeatureMax(hdev, "AutoExposureTimeUpperLimit", &maxUpperLimit);
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "AutoExposureTimeLowerLimit", minLowerLimit);
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "AutoExposureTimeUpperLimit", maxUpperLimit);
CHECK(errRes);
/* Set the target brightness value to 0.6 */
errRes = PylonDeviceSetFloatFeature(hdev, "AutoTargetBrightness", 0.6);
CHECK(errRes);
/* Select auto function ROI 1 */
errRes = PylonDeviceFeatureFromString(hdev, "AutoFunctionROISelector", "ROI1");
CHECK(errRes);
/* Enable the 'Brightness' auto function (Gain Auto + Exposure Auto) */
/* for the auto function ROI selected */
errRes = PylonDeviceSetBooleanFeature(hdev, "AutoFunctionROIUseBrightness", 1);
CHECK(errRes);
/* Enable Exposure Auto by setting the operating mode to Continuous */
errRes = PylonDeviceFeatureFromString(hdev, "ExposureAuto", "Continuous");
CHECK(errRes);
# Set the Exposure Auto auto function to its minimum lower limit
# and its maximum upper limit
minLowerLimit = camera.AutoExposureTimeLowerLimit.Min
maxUpperLimit = camera.AutoExposureTimeUpperLimit.Max
camera.AutoExposureTimeLowerLimit.Value = minLowerLimit
camera.AutoExposureTimeUpperLimit.Value = maxUpperLimit
# Set the target brightness value to 0.6
camera.AutoTargetBrightness.Value = 0.6
# Select auto function ROI 1
camera.AutoFunctionROISelector.Value = "ROI1"
# Enable the 'Brightness' auto function (Gain Auto + Exposure Auto)
# for the auto function ROI selected
camera.AutoFunctionROIUseBrightness.Value = True
# Enable Exposure Auto by setting the operating mode to Continuous
camera.ExposureAuto.Value = "Continuous"

您也可以使用 pylon Viewer 轻松设置参数。