コンテンツにスキップ

Gain Auto#

Gain Autoカメラ機能により、明るさの目標値に達するまで、指定された範囲内でゲインが自動的に調整されます。

オートファンクションの画素データは、1つ以上のオートファンクションROIから取得できます。

Gain AutoとExposure Autoを同時に使用する場合は、Auto Function Profile機能を使用して、両方の効果のバランスを調整する方法を指定します。

ゲインを手動で調整するには、Gain機能を使用します。

機能を使用する#

Gain Autoの有効化/無効化#

Gain Autoオートファンクションを有効または無効にするには、次の手順に従います。

  1. Gain Autoオートファンクションに少なくとも1つのオートファンクションROIを割り当てます。
    オートファンクションROIが画像ROIと部分的または完全にオーバーラップするようにしてください。
  2. パラメーターを GainAuto パラメーターを次のいずれかの動作モードに設定します。
    • Once:カメラは、指定された明るさの目標値に達するまでゲインを調整します。これが達成された場合、または最大30回の計算サイクル後に、カメラはオートファンクションを[Off]に設定し、最後の計算から得られたゲインをそれ以後のすべての画像に適用します。
    • Continuous:画像の取得中にカメラがゲインを継続的に調整します。
    • Off:Gain Autoオートファンクションを無効にします。ゲインは、最後の自動調整または手動調整の結果の値に維持されます。

情報

カメラが画像を連続的にキャプチャしている場合、オートファンクションは短い遅延を伴って有効になります。最初の何枚かの画像は、オートファンクションの影響を受けない場合があります。

上限値/下限値の指定#

オートファンクションにより、ユーザーが指定した範囲内でGainパラメーター値が調整されます。

制限値を変更するには、AutoGainLowerLimitおよびAutoGainUpperLimitパラメーターを目的の値に設定します。

例:AutoGainLowerLimitパラメーターを2に、AutoGainUpperLimitパラメーターを6に設定したとします。自動調整プロセスでは、ゲインが2未満になることはなく、6を超えることもありません。

明るさの目標値の指定#

オートファンクションにより、明るさの目標値(平均グレー値など)に達するまでゲインが調整されます。

目標値を指定するには、AutoTargetBrightnessパラメーターを使用します。

情報

  • 目標値の計算には、Gammaなどの他の画像最適化は含まれません。設定された画像最適化によっては、カメラから出力される画像の平均グレー値が、目標値で示されたグレー値よりも大幅に低くなったり高くなったりする場合があります。
  • また、カメラはAutoTargetBrightnessパラメーターを使用して、Exposure Autoのオートファンクションを制御します。Gain AutoとExposure Autoを同時に行う場合は、Auto Function Profile機能を使用して、両方の効果のバランスの調整方法を指定します。
  • For racer 2 S line scan cameras with CXP interface, the following is true:
    The algorithm for generating the target brightness value is applied on the "camera side", and therefore only applied to a single line, not to the complete frame. The complete frame is built in the frame grabber where the randomly selected lines with the applied target brightness value are part of the assembled frame.
  • 一部のカメラモデルでは、Remove Parameter Limits機能を使用して目標値のパラメーター制限域を拡げることができます。

Basler ace GigEカメラモデルでは、Gray Value Adjustment Damping係数を指定することもできます。Basler dartおよびpulseカメラモデルでは、Brightness Adjustment Damping係数を指定できます。

ダンピング係数を使用すると、目標値に達するまでの時間が長くなります。

サンプルコード#

ace Classic/U/L GigEカメラ#
// 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 = 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);
/* 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);
# Set the the Gain Auto auto function to its minimum lower limit
# and its maximum upper limit
minLowerLimit = camera.AutoGainRawLowerLimit.Min
maxUpperLimit = camera.AutoGainRawUpperLimit.Max
camera.AutoGainRawLowerLimit.Value = minLowerLimit
camera.AutoGainRawUpperLimit.Value = maxUpperLimit
# Specify the target value
camera.AutoTargetValue.Value = 150
# 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 Gain Auto by setting the operating mode to Continuous
camera.GainAuto.Value = "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 = 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);
/* 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);
# Set the the Gain Auto auto function to its minimum lower limit
# and its maximum upper limit
minLowerLimit = camera.AutoGainLowerLimit.Min
maxUpperLimit = camera.AutoGainUpperLimit.Max
camera.AutoGainLowerLimit.Value = minLowerLimit
camera.AutoGainUpperLimit.Value = maxUpperLimit
# Specify the target value
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 Gain Auto by setting the operating mode to Continuous
camera.GainAuto.Value = "Continuous"

pylon Viewerを使用して、パラメーターを簡単に設定することもできます。