Exposure Auto#
自動功能的像素資料可來自一個或多個自動功能 ROI。
若您想使用 `Exposure Auto ` 並 Gain Auto ,請使用 Auto Function Profile 功能來指定兩者效果的平衡方式。
若要手動調整曝光時間,請使用 Exposure Time 功能。
使用功能#
啟用或停用Exposure Auto#
若要啟用或停用「Exposure Auto 」自動功能:
- 請為「Exposure Auto 」自動功能指派至少一個自動功能 ROI。
請確保自動功能 ROI 與影像 ROI存在部分或完全的重疊。 - 將相機中的
ExposureMode參數設為Timed. - 將相機中的
ExposureAuto將參數設定為以下其中一種運作模式:Once: 相機會調整曝光時間,直到達到指定的 目標亮度值 已達到。當此條件達成時,或在最多 30 個計算週期後,相機將將自動功能設定為Off. 對於接下來所有影像,相機都會套用上次計算得出的曝光時間。Continuous: 在拍攝影像的過程中,相機會持續調整曝光時間。Off: 停用「Exposure Auto 」自動功能。曝光時間將維持在最後一次自動或手動調整後的數值。
資訊
當相機進行連續拍攝時,自動功能會稍有延遲才生效。前幾張照片可能不會受到自動功能的影響。
指定下限與上限#
自動功能會調整 ExposureTime 參數值在您指定的範圍內。
若要變更限制,請設定 AutoExposureTimeLowerLimit 及 AutoExposureTimeUpperLimit 將參數設定為所需值(單位為 µs)。
範例: 假設您已設定了 AutoExposureTimeLowerLimit 將參數設為 1000,然後 AutoExposureTimeUpperLimit 將參數設定為 5000。在自動調整過程中,曝光時間絕不會低於 1000 µs,也不會高於 5000 µs。
若 buffer operator 的 AutoExposureTimeUpperLimit 當該參數設定為較高數值時,相機的 幀率 可能會減少。
指定目標亮度值#
自動功能會調整曝光時間,直到達到目標亮度值(即平均灰階值)為止。
若要指定目標值,請使用 AutoTargetBrightness 參數中選擇性地指定 HTML 記錄檔 (*.html) 的路徑與檔名。
資訊
- 目標值的計算不包含其他影像優化設定,例如: Gamma。根據所設定的影像優化參數,相機輸出的影像平均灰階值可能會比目標值所顯示的數值低或高出許多。
- 這台相機還採用了
AutoTargetBrightness用於控制該的參數 Gain Auto 自動功能。若您想使用Exposure Auto 以及 Gain Auto 同時,請使用 Auto Function Profile 此功能可指定兩者效果的平衡方式。 - 對於配備 CXP 介面的racer 2 S 線掃描相機,情況如下:
生成目標亮度值的演算法是在「相機端」執行的,因此僅套用至單一行,而非整個畫面。整個畫面是在幀擷取卡中組建的,其中隨機選取且已套用目標亮度值的行,將成為組裝後畫面的組成部分。 - 在某些相機型號上,您可以使用 Remove Parameter Limits 功能來提高目標值參數的限制。
在 Basler ace GigE 相機型號上,您也可以指定一個 Gray Value Adjustment Damping 係數。在 Basler dart 和 pulse 相機型號上,您可以指定一個 Brightness Adjustment Damping 係數。
當使用阻尼係數時,達到目標值的速度會較慢。
範例程式碼#
ace Classic/U/L GigE 相機#
// Set the Exposure Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = camera.AutoExposureTimeLowerLimitRaw.GetMin();
double maxUpperLimit = camera.AutoExposureTimeUpperLimitRaw.GetMax();
camera.AutoExposureTimeLowerLimitRaw.SetValue(minLowerLimit);
camera.AutoExposureTimeUpperLimitRaw.SetValue(maxUpperLimit);
// Set the target brightness value to 128
camera.AutoTargetValue.SetValue(128);
// 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 Exposure Auto by setting the operating mode to Continuous
camera.ExposureAuto.SetValue(ExposureAuto_Continuous);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Exposure Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = CFloatParameter(nodemap, "AutoExposureTimeLowerLimitRaw").GetMin();
double maxUpperLimit = CFloatParameter(nodemap, "AutoExposureTimeUpperLimitRaw").GetMax();
CFloatParameter(nodemap, "AutoExposureTimeLowerLimitRaw").SetValue(minLowerLimit);
CFloatParameter(nodemap, "AutoExposureTimeUpperLimitRaw").SetValue(maxUpperLimit);
// Set the target brightness value to 128
CIntegerParameter(nodemap, "AutoTargetValue").SetValue(128);
// 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 Exposure Auto by setting the operating mode to Continuous
CEnumParameter(nodemap, "ExposureAuto").SetValue("Continuous");
// Set the Exposure Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = camera.Parameters[PLCamera.AutoExposureTimeLowerLimitRaw].GetMinimum();
double maxUpperLimit = camera.Parameters[PLCamera.AutoExposureTimeUpperLimitRaw].GetMaximum();
camera.Parameters[PLCamera.AutoExposureTimeLowerLimitRaw].SetValue(minLowerLimit);
camera.Parameters[PLCamera.AutoExposureTimeUpperLimitRaw].SetValue(maxUpperLimit);
// Set the target brightness value to 128
camera.Parameters[PLCamera.AutoTargetValue].SetValue(128);
// 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 Exposure Auto by setting the operating mode to Continuous
camera.Parameters[PLCamera.ExposureAuto].SetValue(PLCamera.ExposureAuto.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 Exposure Auto auto function to its minimum lower limit */
/* and its maximum upper limit */
errRes = PylonDeviceGetFloatFeatureMin(hdev, "AutoExposureTimeLowerLimitRaw", &minLowerLimit);
CHECK(errRes);
errRes = PylonDeviceGetFloatFeatureMax(hdev, "AutoExposureTimeUpperLimitRaw", &maxUpperLimit);
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "AutoExposureTimeLowerLimitRaw", minLowerLimit);
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "AutoExposureTimeUpperLimitRaw", maxUpperLimit);
CHECK(errRes);
/* Set the target brightness value to 128 */
errRes = PylonDeviceSetIntegerFeature(hdev, "AutoTargetValue", 128);
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 Exposure Auto by setting the operating mode to Continuous */
errRes = PylonDeviceFeatureFromString(hdev, "ExposureAuto", "Continuous");
CHECK(errRes);
# Set the Exposure Auto auto function to its minimum lower limit
# and its maximum upper limit
minLowerLimit = camera.AutoExposureTimeLowerLimitRaw.Min
maxUpperLimit = camera.AutoExposureTimeUpperLimitRaw.Max
camera.AutoExposureTimeLowerLimitRaw.Value = minLowerLimit
camera.AutoExposureTimeUpperLimitRaw.Value = maxUpperLimit
# Set the target brightness value to 128
camera.AutoTargetValue.Value = 128
# 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 Exposure Auto by setting the operating mode to Continuous
camera.ExposureAuto.Value = "Continuous"
其他相機#
// Set the Exposure Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = camera.AutoExposureTimeLowerLimit.GetMin();
double maxUpperLimit = camera.AutoExposureTimeUpperLimit.GetMax();
camera.AutoExposureTimeLowerLimit.SetValue(minLowerLimit);
camera.AutoExposureTimeUpperLimit.SetValue(maxUpperLimit);
// Set the target brightness value to 0.6
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 Exposure Auto by setting the operating mode to Continuous
camera.ExposureAuto.SetValue(ExposureAuto_Continuous);
INodeMap& nodemap = camera.GetNodeMap();
// Set the Exposure Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = CFloatParameter(nodemap, "AutoExposureTimeLowerLimit").GetMin();
double maxUpperLimit = CFloatParameter(nodemap, "AutoExposureTimeUpperLimit").GetMax();
CFloatParameter(nodemap, "AutoExposureTimeLowerLimit").SetValue(minLowerLimit);
CFloatParameter(nodemap, "AutoExposureTimeUpperLimit").SetValue(maxUpperLimit);
// Set the target brightness value to 0.6
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 Exposure Auto by setting the operating mode to Continuous
CEnumParameter(nodemap, "ExposureAuto").SetValue("Continuous");
// Set the Exposure Auto auto function to its minimum lower limit
// and its maximum upper limit
double minLowerLimit = camera.Parameters[PLCamera.AutoExposureTimeLowerLimit].GetMinimum();
double maxUpperLimit = camera.Parameters[PLCamera.AutoExposureTimeUpperLimit].GetMaximum();
camera.Parameters[PLCamera.AutoExposureTimeLowerLimit].SetValue(minLowerLimit);
camera.Parameters[PLCamera.AutoExposureTimeUpperLimit].SetValue(maxUpperLimit);
// Set the target brightness value to 0.6
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 Exposure Auto by setting the operating mode to Continuous
camera.Parameters[PLCamera.ExposureAuto].SetValue(PLCamera.ExposureAuto.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 Exposure Auto auto function to its minimum lower limit */
/* and its maximum upper limit */
errRes = PylonDeviceGetFloatFeatureMin(hdev, "AutoExposureTimeLowerLimit", &minLowerLimit);
CHECK(errRes);
errRes = PylonDeviceGetFloatFeatureMax(hdev, "AutoExposureTimeUpperLimit", &maxUpperLimit);
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "AutoExposureTimeLowerLimit", minLowerLimit);
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "AutoExposureTimeUpperLimit", maxUpperLimit);
CHECK(errRes);
/* Set the target brightness value to 0.6 */
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 Exposure Auto by setting the operating mode to Continuous */
errRes = PylonDeviceFeatureFromString(hdev, "ExposureAuto", "Continuous");
CHECK(errRes);
# Set the Exposure Auto auto function to its minimum lower limit
# and its maximum upper limit
minLowerLimit = camera.AutoExposureTimeLowerLimit.Min
maxUpperLimit = camera.AutoExposureTimeUpperLimit.Max
camera.AutoExposureTimeLowerLimit.Value = minLowerLimit
camera.AutoExposureTimeUpperLimit.Value = maxUpperLimit
# Set the target brightness value to 0.6
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 Exposure Auto by setting the operating mode to Continuous
camera.ExposureAuto.Value = "Continuous"
您也可以 use the pylon Viewer 來輕鬆設定參數。