Gain Auto#
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.
Using the Feature#
Prerequisites#
- At least one auto function ROI must be assigned to the Gain Auto auto function.
- The auto function ROI assigned must overlap the image ROI, either partially or completely.
Enabling or Disabling Gain Auto#
To enable or disable the Gain Auto auto function, set the GainAuto parameter to one of the following operating modes:
- Once: The camera adjusts the gain 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!! and applies the gain resulting from the last calculation to all following images.
- Continuous: The camera adjusts the gain continuously while images are being acquired.
- Off: Disables the Gain Auto auto function. The gain remains at the value resulting from the last automatic or manual adjustment.
Info
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.
Specifying Lower and Upper Limits#
The auto function adjusts the Gain parameter value within limits specified by you.
To change the limits, set the AutoGainLowerLimit and the AutoGainUpperLimit parameters to the desired values.
Example: Assume you have set the AutoGainLowerLimit parameter to 2 and the AutoGainUpperLimit parameter to 6. During the automatic adjustment process, the gain will never be lower than 2 and never higher than 6.
Specifying the Target Brightness Value#
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 AutoTargetBrightness parameter. The parameter's value range depends on the camera model and the pixel format used.
Info
- The target value calculation does not include other image optimizations, e.g., Gamma. Depending on the image optimizations set, images output by the camera may have a significantly lower or higher average gray value than indicated by the target value.
- The camera also uses the AutoTargetBrightness parameter to control the Exposure Autoauto function. 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.
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.
Specifics#
Info
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 |
---|---|---|
a2A1920-51gcBAS | Feature not supported | Feature not supported |
a2A1920-51gmBAS | Feature not supported | Feature not supported |
a2A1920-160ucBAS | Feature not supported | Feature not supported |
a2A1920-160umBAS | Feature not supported | Feature not supported |
acA640-90gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA640-90gm | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA640-90uc | 0.2a | 0.8a |
acA640-90um | 0.2a | 0.8a |
acA640-120gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA640-120gm | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA640-120uc | 0.2a | 0.8a |
acA640-120um | 0.2a | 0.8a |
acA640-121gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA640-300gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA640-300gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA640-750uc | 0.2a | 0.8a |
acA640-750um | 0.2a | 0.8a |
acA720-290gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA720-290gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA720-520uc | 0.2a | 0.8a |
acA720-520um | 0.2a | 0.8a |
acA780-75gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA780-75gm | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA800-200gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA800-200gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA800-510uc | 0.2a | 0.8a |
acA800-510um | 0.2a | 0.8a |
acA1280-60gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1280-60gm | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1300-22gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1300-22gm | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1300-30gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1300-30gm | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1300-30uc | 0.2a | 0.8a |
acA1300-30um | 0.2a | 0.8a |
acA1300-60gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1300-60gm | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1300-60gmNIR | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1300-75gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA1300-75gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA1300-200uc | 0.2a | 0.8a |
acA1300-200um | 0.2a | 0.8a |
acA1440-73gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA1440-73gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA1440-220uc | 0.2a | 0.8a |
acA1440-220um | 0.2a | 0.8a |
acA1600-20gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1600-20gm | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1600-20uc | 0.2a | 0.8a |
acA1600-20um | 0.2a | 0.8a |
acA1600-60gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1600-60gm | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1920-25gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1920-25gm | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA1920-25uc | 0.2a | 0.8a |
acA1920-25um | 0.2a | 0.8a |
acA1920-40gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA1920-40gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA1920-40uc | 0.2a | 0.8a |
acA1920-40ucMED | 0.2a | 0.8a |
acA1920-40um | 0.2a | 0.8a |
acA1920-40umMED | 0.2a | 0.8a |
acA1920-48gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA1920-48gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA1920-50gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA1920-50gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA1920-150uc | 0.2a | 0.8a |
acA1920-150um | 0.2a | 0.8a |
acA1920-155uc | 0.2a | 0.8a |
acA1920-155ucMED | 0.2a | 0.8a |
acA1920-155um | 0.2a | 0.8a |
acA1920-155umMED | 0.2a | 0.8a |
acA2000-50gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA2000-50gm | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA2000-50gmNIR | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA2000-165uc | 0.2a | 0.8a |
acA2000-165um | 0.2a | 0.8a |
acA2000-165umNIR | 0.2a | 0.8a |
acA2040-25gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA2040-25gm | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA2040-25gmNIR | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA2040-35gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA2040-35gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA2040-55uc | 0.2a | 0.8a |
acA2040-55um | 0.2a | 0.8a |
acA2040-90uc | 0.2a | 0.8a |
acA2040-90um | 0.2a | 0.8a |
acA2040-90umNIR | 0.2a | 0.8a |
acA2040-120uc | 0.2a | 0.8a |
acA2040-120um | 0.2a | 0.8a |
acA2440-20gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA2440-20gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA2440-35uc | 0.2a | 0.8a |
acA2440-35ucMED | 0.2a | 0.8a |
acA2440-35um | 0.2a | 0.8a |
acA2440-35umMED | 0.2a | 0.8a |
acA2440-75uc | 0.2a | 0.8a |
acA2440-75ucMED | 0.2a | 0.8a |
acA2440-75um | 0.2a | 0.8a |
acA2440-75umMED | 0.2a | 0.8a |
acA2500-14gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA2500-14gm | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA2500-14uc | 0.2a | 0.8a |
acA2500-14um | 0.2a | 0.8a |
acA2500-20gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA2500-20gcMED | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA2500-20gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA2500-20gmMED | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA2500-60uc | 0.2a | 0.8a |
acA2500-60um | 0.2a | 0.8a |
acA3088-16gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA3088-16gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA3088-57uc | 0.2a | 0.8a |
acA3088-57um | 0.2a | 0.8a |
acA3800-10gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA3800-10gm | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA3800-14uc | 0.2a | 0.8a |
acA3800-14um | 0.2a | 0.8a |
acA4024-8gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA4024-8gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA4024-29uc | 0.2a | 0.8a |
acA4024-29um | 0.2a | 0.8a |
acA4096-11gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA4096-11gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA4096-30uc | 0.2a | 0.8a |
acA4096-30ucMED | 0.2a | 0.8a |
acA4096-30um | 0.2a | 0.8a |
acA4096-30umMED | 0.2a | 0.8a |
acA4096-40uc | 0.2a | 0.8a |
acA4096-40ucMED | 0.2a | 0.8a |
acA4096-40um | 0.2a | 0.8a |
acA4096-40umMED | 0.2a | 0.8a |
acA4112-8gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA4112-8gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA4112-20uc | 0.2a | 0.8a |
acA4112-20ucMED | 0.2a | 0.8a |
acA4112-20um | 0.2a | 0.8a |
acA4112-20umMED | 0.2a | 0.8a |
acA4112-30uc | 0.2a | 0.8a |
acA4112-30ucMED | 0.2a | 0.8a |
acA4112-30um | 0.2a | 0.8a |
acA4112-30umMED | 0.2a | 0.8a |
acA4600-7gc | 8-bit pixel formats: 2 12-bit pixel formats: 32 | 8-bit pixel formats: 253 12-bit pixel formats: 4048 |
acA4600-10uc | 0.2a | 0.8a |
acA5472-5gc | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA5472-5gm | 8-bit pixel formats: 50 12-bit pixel formats: 800 | 8-bit pixel formats: 205 12-bit pixel formats: 3280 |
acA5472-17uc | 0.2a | 0.8a |
acA5472-17um | 0.2a | 0.8a |
boA4096-93cc | Feature not supported | Feature not supported |
boA4096-93cm | Feature not supported | Feature not supported |
boA4112-68cc | Feature not supported | Feature not supported |
boA4112-68cm | Feature not supported | Feature not supported |
daA1280-54lc | 0.1a | 1.0a |
daA1280-54lm | 0.1a | 1.0a |
daA1280-54uc | 0.1a | 1.0a |
daA1280-54um | 0.1a | 1.0a |
daA1600-60lc | 0.1a | 1.0a |
daA1600-60lm | 0.1a | 1.0a |
daA1600-60uc | 0.1a | 1.0a |
daA1600-60um | 0.1a | 1.0a |
daA1920-15um | 0.1a | 1.0a |
daA1920-30uc | 0.1a | 1.0a |
daA1920-30um | 0.1a | 1.0a |
daA2500-14lc | 0.1a | 1.0a |
daA2500-14lm | 0.1a | 1.0a |
daA2500-14uc | 0.1a | 1.0a |
daA2500-14um | 0.1a | 1.0a |
daA2500-60mc | 0.1a | 1.0a |
puA1280-54uc | 0.1a | 1.0a |
puA1280-54um | 0.1a | 1.0a |
puA1600-60uc | 0.1a | 1.0a |
puA1600-60um | 0.1a | 1.0a |
puA1920-30uc | 0.1a | 1.0a |
puA1920-30um | 0.1a | 1.0a |
puA2500-14uc | 0.1a | 1.0a |
puA2500-14um | 0.1a | 1.0a |
-
The 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.
Sample Code#
ace classic/U/L GigE cameras#
// 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);
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");
INodeMap& nodemap = camera.GetNodeMap(); // Set the the Gain Auto auto function to its minimum lower limit // and its maximum upper limit double minLowerLimit = CFloatParameter(nodemap, "AutoGainRawLowerLimit").GetMin(); double maxUpperLimit = CFloatParameter(nodemap, "AutoGainRawUpperLimit").GetMax(); CFloatParameter(nodemap, "AutoGainRawLowerLimit").SetValue(minLowerLimit); CFloatParameter(nodemap, "AutoGainRawUpperLimit").SetValue(maxUpperLimit); // Specify the target value CIntegerParameter(nodemap, "AutoTargetValue").SetValue(150); // 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 Gain Auto by setting the operating mode to Continuous CEnumParameter(nodemap, "GainAuto").SetValue("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 = 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");
/* 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);
Other Cameras#
// 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("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");
INodeMap& nodemap = camera.GetNodeMap(); // Set the the Gain Auto auto function to its minimum lower limit // and its maximum upper limit double minLowerLimit = CFloatParameter(nodemap, "AutoGainLowerLimit").GetMin(); double maxUpperLimit = CFloatParameter(nodemap, "AutoGainUpperLimit").GetMax(); CFloatParameter(nodemap, "AutoGainLowerLimit").SetValue(minLowerLimit); CFloatParameter(nodemap, "AutoGainUpperLimit").SetValue(maxUpperLimit); // Specify the target value 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 Gain Auto by setting the operating mode to Continuous CEnumParameter(nodemap, "GainAuto").SetValue("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, "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, "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.