The Gain Auto camera feature automatically adjusts the gain within specified limits until a target brightness value has been reached.
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.
To enable or disable the Gain Auto auto function, set the GainAuto parameter to one of the following operating modes:
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
On daA2500-60mc cameras, enabling or disabling Gain Auto also enables or disables Exposure Auto.
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.
This functionality is available for daA…mci cameras only.
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.
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 Auto auto 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.
// Set the the Gain Auto auto function to its maximum upper limitdoublemaxUpperLimit=camera.AutoGainUpperLimit.GetMax();camera.AutoGainUpperLimit.SetValue(maxUpperLimit);// Specify the target valuecamera.AutoTargetBrightness.SetValue(0.6);// Enable Gain Auto by setting the operating mode to Continuouscamera.GainAuto.SetValue(GainAuto_Continuous);
INodeMap&nodemap=camera.GetNodeMap();// Set the the Gain Auto auto function to its maximum upper limitdoublemaxUpperLimit=CFloatParameter(nodemap,"AutoGainUpperLimit").GetMax();CFloatParameter(nodemap,"AutoGainUpperLimit").SetValue(maxUpperLimit);// Specify the target valueCFloatParameter(nodemap,"AutoTargetBrightness").SetValue(0.6);// Enable Gain Auto by setting the operating mode to ContinuousCEnumParameter(nodemap,"GainAuto").SetValue("Continuous");
// Set the the Gain Auto auto function to its maximum upper limitdoublemaxUpperLimit=camera.Parameters[PLCamera.AutoGainUpperLimit].GetMaximum();camera.Parameters[PLCamera.AutoGainUpperLimit].SetValue(maxUpperLimit);// Specify the target valuecamera.Parameters[PLCamera.AutoTargetBrightness].SetValue(0.6);// Enable Gain Auto by setting the operating mode to Continuouscamera.Parameters[PLCamera.GainAuto].SetValue(PLCamera.GainAuto.Continuous);
/* Macro to check for errors */#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)GENAPIC_RESULTerrRes=GENAPI_E_OK;/* Return value of pylon methods */doublemaxUpperLimit=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 limitmaxUpperLimit=camera.AutoGainUpperLimit.Maxcamera.AutoGainUpperLimit.Value=maxUpperLimit# Specify the target valuecamera.AutoTargetBrightness.Value=0.6# Enable Gain Auto by setting the operating mode to Continuouscamera.GainAuto.Value="Continuous"
You can also use the pylon Viewer to easily set the parameters.