跳至內容
測試伺服器
開發伺服器

Gain Auto (dart E)#

Gain Auto 相機功能會自動在指定的限制內調整 gain,直到達到目標亮度值為止。

如果您想要同時使用 Gain Auto 與 Exposure Auto,請使用 Auto Function Profile 功能來指定兩者效果如何平衡。

若要手動調整增益,請使用 Gain 功能。

使用功能#

啟用或停用 Gain Auto#

若要啟用或停用 Gain Auto 自動功能,請設定 GainAuto 參數設為下列其中一個 Operating Mode:

  • Continuous:在擷取影像時,相機會持續調整增益。
  • Off:停用 Gain Auto 自動功能。增益將維持在上次自動或手動調整所產生的數值。

資訊

  • 在 daA2500-60mc 相機上,啟用或停用 Gain Auto 也會一併啟用或停用 Exposure Auto。
  • 當相機持續擷取影像時,自動功能會稍有延遲地生效。前幾張影像可能不會受到自動功能的影響。

指定上限#

資訊

此功能僅適用於 daA…mci 相機。

自動功能會在您指定的限制內調整 Gain 參數值在指定的限制範圍內。

若要變更上限,請將 AutoGainUpperLimit 參數設為所需的值(以 µs 為單位)。

在自動調整過程中,增益絕不會高於指定的上限。

指定目標亮度值#

資訊

此功能僅適用於 daA…mci 相機。

自動功能會調整增益,直到達到目標亮度值(即平均灰階值)為止。

若要指定目標值,請使用 AutoTargetBrightness 參數中選擇性地指定 HTML 記錄檔 (*.html) 的路徑與檔名。

資訊

  • 目標值的計算不包含其他影像最佳化功能,例如 Gamma。根據所設定的影像最佳化功能,相機輸出的影像平均灰階值可能會顯著低於或高於目標值所指示的數值。
  • 相機同時也會使用 AutoTargetBrightness 參數來控制 Exposure Auto 自動功能。如果您想要同時使用 Gain Auto 與 Exposure Auto ,請使用 Auto Function Profile 功能來指定兩者效果的平衡方式。

範例程式碼#

// Set the the Gain Auto auto function to its maximum upper limit
double maxUpperLimit = camera.AutoGainUpperLimit.GetMax();
camera.AutoGainUpperLimit.SetValue(maxUpperLimit);
// Specify the target value
camera.AutoTargetBrightness.SetValue(0.6);
// 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 maximum upper limit
double maxUpperLimit = CFloatParameter(nodemap, "AutoGainUpperLimit").GetMax();
CFloatParameter(nodemap, "AutoGainUpperLimit").SetValue(maxUpperLimit);
// Specify the target value
CFloatParameter(nodemap, "AutoTargetBrightness").SetValue(0.6);
// Enable Gain Auto by setting the operating mode to Continuous
CEnumParameter(nodemap, "GainAuto").SetValue("Continuous");
// Set the the Gain Auto auto function to its maximum upper limit
double maxUpperLimit = camera.Parameters[PLCamera.AutoGainUpperLimit].GetMaximum();
camera.Parameters[PLCamera.AutoGainUpperLimit].SetValue(maxUpperLimit);
// Specify the target value
camera.Parameters[PLCamera.AutoTargetBrightness].SetValue(0.6);
// 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 maxUpperLimit = 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 limit
maxUpperLimit = camera.AutoGainUpperLimit.Max
camera.AutoGainUpperLimit.Value = maxUpperLimit
# Specify the target value
camera.AutoTargetBrightness.Value = 0.6
# Enable Gain Auto by setting the operating mode to Continuous
camera.GainAuto.Value = "Continuous"

您也可以使用 pylon Viewer 輕鬆設定參數。