The pixel data for the auto function can come from one or multiple auto function ROIs.
If you want to use Gain Auto and Exposure Auto at the same time, use the Auto Function Profile feature to specify how the effects of both are balanced.
To adjust the gain manually, use the Gain feature.
In this topic Hide
To enable or disable the Gain Auto auto function, set the GainAuto parameter to one of the following operating modes:
When the camera is capturing images continuously, the auto function takes effect with a short delay. The first few images may not be affected by the auto function.
The auto function adjusts the GainRawGain parameter value within limits specified by you.
To change the limits, set the AutoGainRawLowerLimitAutoGainLowerLimit and the AutoGainRawUpperLimitAutoGainUpperLimit parameters to the desired values.
Example: Assume you have set the AutoGainRawLowerLimitAutoGainLowerLimit parameter to 2 and the AutoGainRawUpperLimitAutoGainUpperLimit parameter to 6. During the automatic adjustment process, the gain will never be lower than 2 and never higher than 6.
The auto function adjusts the gain until a target brightness value, i.e., an average gray value, has been reached.
To specify the target value, use the AutoTargetValueAutoTargetBrightness parameter. The parameter's value range depends on the camera model and the pixel format used.
On Basler ace GigE camera models, you can also specify a Gray Value Adjustment Damping factor. On Basler dart and pulse camera models, you can specify a Brightness Adjustment Damping factor.
When a damping factor is used, the target value is reached more slowly.
On some camera models, you can use the Remove Parameter Limits feature to increase the target value parameter limits.
Camera Model | Minimum Target Value |
Maximum Target Value |
---|---|---|
All ace 2 GigE camera models | Feature not supported | Feature not supported |
All ace 2 USB 3.0 camera models | Feature not supported | Feature not supported |
All ace classic GigE camera models | 2 / 32a | 253 / 4048a |
All ace U GigE camera models |
50 / 800a |
205 / 3280a |
All ace L GigE camera models | 50 / 800a | 205 / 3280a |
All ace USB 3.0 camera models | 0.2b | 0.8b |
All boost CXP-12 camera models | Feature not supported | Feature not supported |
All dart BCON for LVDS camera models | 0.1b | 1.0b |
All dart BCON for MIPI camera models | Feature not supported (see Gain/Exposure Auto) | Feature not supported (see Gain/Exposure Auto) |
All dart USB 3.0 camera models | 0.1b | 1.0b |
All pulse USB 3.0 camera models | 0.1b | 1.0b |
a8-bit / 12-bit pixel format
bThe parameter's value range is based on the gray value range of the pixel format selected. For example, if you have selected an 8-bit pixel format, the maximum gray value is 256. Therefore, a parameter value of 0.5 corresponds to a gray value of approximately 128.
// Set the the Gain Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = camera.AutoGainRawLowerLimit.GetMin();
double maxUpperLimit = camera.AutoGainRawUpperLimit.GetMax();
camera.AutoGainRawLowerLimit.SetValue(minLowerLimit);
camera.AutoGainRawUpperLimit.SetValue(maxUpperLimit);
// Specify the target value
camera.AutoTargetValue.SetValue(150);
// 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 Gain Auto by setting the operating mode to Continuous
camera.GainAuto.SetValue(GainAuto_Continuous);
// Set the the Gain Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = camera.AutoGainLowerLimit.GetMin();
double maxUpperLimit = camera.AutoGainUpperLimit.GetMax();
camera.AutoGainLowerLimit.SetValue(minLowerLimit);
camera.AutoGainUpperLimit.SetValue(maxUpperLimit);
// Specify the target value
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 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 minimum lower limit
// and its maximum upper limit
double minLowerLimit = CFloatPtr(nodemap.GetNode("AutoGainRawLowerLimit"))->GetMin();
double maxUpperLimit = CFloatPtr(nodemap.GetNode("AutoGainRawUpperLimit"))->GetMax();
CFloatPtr(nodemap.GetNode("AutoGainRawLowerLimit"))->SetValue(minLowerLimit);
CFloatPtr(nodemap.GetNode("AutoGainRawUpperLimit"))->SetValue(maxUpperLimit);
// Specify the target value
CIntegerPtr(nodemap.GetNode("AutoTargetValue"))->SetValue(150);
// Select auto function ROI 1
CEnumerationPtr(nodemap.GetNode("AutoFunctionAOISelector"))->FromString("AOI1");
// Enable the 'Intensity' auto function (Gain Auto + Exposure Auto)
// for the auto function ROI selected
CBooleanPtr(nodemap.GetNode("AutoFunctionAOIUsageIntensity"))->SetValue(true);
// Enable Gain Auto by setting the operating mode to Continuous
CEnumerationPtr(nodemap.GetNode("GainAuto"))->FromString("Continuous");
// Set the the Gain Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = CFloatPtr(nodemap.GetNode("AutoGainLowerLimit"))->GetMin();
double maxUpperLimit = CFloatPtr(nodemap.GetNode("AutoGainUpperLimit"))->GetMax();
CFloatPtr(nodemap.GetNode("AutoGainLowerLimit"))->SetValue(minLowerLimit);
CFloatPtr(nodemap.GetNode("AutoGainUpperLimit"))->SetValue(maxUpperLimit);
// Specify the target value
CFloatPtr(nodemap.GetNode("AutoTargetBrightness"))->SetValue(0.6);
// Select auto function ROI 1
CEnumerationPtr(nodemap.GetNode("AutoFunctionROISelector"))->FromString("ROI1");
// Enable the 'Brightness' auto function (Gain Auto + Exposure Auto)
// for the auto function ROI selected
CBooleanPtr(nodemap.GetNode("AutoFunctionROIUseBrightness"))->SetValue(true);
// Enable Gain Auto by setting the operating mode to Continuous
CEnumerationPtr(nodemap.GetNode("GainAuto"))->FromString("Continuous");
// Set the the Gain Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = camera.Parameters[PLCamera.AutoGainRawLowerLimit].GetMinimum();
double maxUpperLimit = camera.Parameters[PLCamera.AutoGainRawUpperLimit].GetMaximum();
camera.Parameters[PLCamera.AutoGainRawLowerLimit].SetValue(minLowerLimit);
camera.Parameters[PLCamera.AutoGainRawUpperLimit].SetValue(maxUpperLimit);
// Specify the target value
camera.Parameters[PLCamera.AutoTargetValue].SetValue(150);
// 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 Gain Auto by setting the operating mode to Continuous
camera.Parameters[PLCamera.GainAuto].SetValue(PLCamera.GainAuto.Continuous);
// Set the the Gain Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = camera.Parameters[PLCamera.AutoGainLowerLimit].GetMinimum();
double maxUpperLimit = camera.Parameters[PLCamera.AutoGainUpperLimit].GetMaximum();
camera.Parameters[PLCamera.AutoGainLowerLimit].SetValue(minLowerLimit);
camera.Parameters[PLCamera.AutoGainUpperLimit].SetValue(maxUpperLimit);
// Specify the target value
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 Gain Auto by setting the operating mode to Continuous
camera.Parameters[PLCamera.GainAuto].SetValue(PLCamera.GainAuto.Continuous);
// Set the the Gain Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = Pylon.DeviceGetFloatFeatureMin(hdev, "AutoGainRawLowerLimit");
double maxUpperLimit = Pylon.DeviceGetFloatFeatureMax(hdev, "AutoGainRawUpperLimit");
Pylon.DeviceSetFloatFeature(hdev, "AutoGainRawLowerLimit", minLowerLimit);
Pylon.DeviceSetFloatFeature(hdev, "AutoGainRawUpperLimit", maxUpperLimit);
// Specify the target value
Pylon.DeviceSetIntegerFeature(hdev, "AutoTargetValue", 150);
// Select auto function ROI 1
Pylon.DeviceFeatureFromString(hdev, "AutoFunctionAOISelector", "AOI1");
// Enable the 'Intensity' auto function (Gain Auto + Exposure Auto)
// for the auto function ROI selected
Pylon.DeviceSetBooleanFeature(hdev, "AutoFunctionAOIUsageIntensity", true);
// Enable Gain Auto by setting the operating mode to Continuous
Pylon.DeviceFeatureFromString(hdev, "GainAuto", "Continuous");
// Set the the Gain Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = Pylon.DeviceGetFloatFeatureMin(hdev, "AutoGainLowerLimit");
double maxUpperLimit = Pylon.DeviceGetFloatFeatureMax(hdev, "AutoGainUpperLimit");
Pylon.DeviceSetFloatFeature(hdev, "AutoGainLowerLimit", minLowerLimit);
Pylon.DeviceSetFloatFeature(hdev, "AutoGainUpperLimit", maxUpperLimit);
// Specify the target value
Pylon.DeviceSetFloatFeature(hdev, "AutoTargetBrightness", 0.6);
// Select auto function ROI 1
Pylon.DeviceFeatureFromString(hdev, "AutoFunctionROISelector", "ROI1");
// Enable the 'Brightness' auto function (Gain Auto + Exposure Auto)
// for the auto function ROI selected
Pylon.DeviceSetBooleanFeature(hdev, "AutoFunctionROIUseBrightness", true);
// Enable Gain Auto by setting the operating mode to Continuous
Pylon.DeviceFeatureFromString(hdev, "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 minLowerLimit = 0;
double maxUpperLimit = 0;
/* Set the the Gain Auto auto function to its minimum lower limit */
/* and its maximum upper limit */
errRes = PylonDeviceGetFloatFeatureMin(hdev, "AutoGainRawLowerLimit", &minLowerLimit);
CHECK(errRes);
errRes = PylonDeviceGetFloatFeatureMax(hdev, "AutoGainRawUpperLimit", &maxUpperLimit);
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "AutoGainRawLowerLimit", minLowerLimit);
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "AutoGainRawUpperLimit", maxUpperLimit);
CHECK(errRes);
/* Specify the target value */
errRes = PylonDeviceSetIntegerFeature(hdev, "AutoTargetValue", 150);
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 Gain Auto by setting the operating mode to Continuous */
errRes = PylonDeviceFeatureFromString(hdev, "GainAuto", "Continuous");
CHECK(errRes);
double minLowerLimit = 0;
double maxUpperLimit = 0;
/* Set the the Gain Auto auto function to its minimum lower limit */
/* and its maximum upper limit */
errRes = PylonDeviceGetFloatFeatureMin(hdev, "AutoGainLowerLimit", &minLowerLimit);
CHECK(errRes);
errRes = PylonDeviceGetFloatFeatureMax(hdev, "AutoGainUpperLimit", &maxUpperLimit);
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "AutoGainLowerLimit", minLowerLimit);
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "AutoGainUpperLimit", maxUpperLimit);
CHECK(errRes);
/* Specify the target value */
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 Gain Auto by setting the operating mode to Continuous */
errRes = PylonDeviceFeatureFromString(hdev, "GainAuto", "Continuous");
CHECK(errRes);
You can also use the pylon Viewer to easily set the parameters.