Exposure Auto#
自動功能的像素資料可以來自一個或多個 Auto Function ROI。
如果您想要同時使用 Exposure Auto 與 Gain Auto,請使用 Auto Function Profile 功能來指定兩者效果如何平衡。
若要手動調整曝光時間,請使用 Exposure Time 功能。
使用功能#
啟用或停用 Exposure Auto#
若要啟用或停用 Exposure Auto 自動功能:
- 指派 至少一個 Auto Function ROI 至 Exposure Auto 自動功能。
確保 Auto Function ROI 與 Image ROI 部分或完全重疊。 - 將相機中的
ExposureMode參數設為Timed. - 將相機中的
ExposureAuto參數設為下列其中一個 Operating Mode:Once:相機調整曝光時間,直到指定的 目標亮度值 已達到。當達成此目標,或經過最多 30 個計算週期後,相機將自動功能設為Off。對於所有後續影像,相機將套用最後一次計算所得出的曝光時間。Continuous:相機在擷取影像時會持續調整曝光時間。Off:停用 Exposure Auto 自動功能。曝光時間維持在上次自動或手動調整所得出的數值。
資訊
當相機持續擷取影像時,自動功能會稍有延遲地生效。前幾張影像可能不會受到自動功能的影響。
指定上下限#
自動功能會在您指定的限制內調整 ExposureTime 參數值。
若要變更限制,請將 AutoExposureTimeLowerLimit 及 AutoExposureTimeUpperLimit 參數設為所需的數值(單位為 µs)。
範例: 假設您將 AutoExposureTimeLowerLimit 參數設為 1000,並將 AutoExposureTimeUpperLimit 參數設為 5000。在自動調整過程中,曝光時間將絕不會低於 1000 µs,也絕不會高於 5000 µs。
若 buffer operator 的 AutoExposureTimeUpperLimit 參數設為較高值時,相機的 frame rate 可能會降低。
指定目標亮度值#
自動功能會調整曝光時間,直到達到目標亮度值(即平均灰階值)為止。
若要指定目標值,請使用 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 來輕鬆設定參數。