Pattern Removal Auto#
使用功能#
為何要使用Pattern Removal Auto#
某些相機輸出的影像可能會出現類似疊加棋盤格圖案的瑕疵。這是由於感光元件的特定設計所致。感光元件陣列中任何 2×2 像素,僅當光線垂直入射至感光元件表面時,才會對光線產生完全相同的反應。若光線以傾斜角度入射,這些像素的反應便會略有差異,從而導致影像中出現棋盤格圖案。
您可以透過確保對原始像素值套用適當的校正係數,來消除棋盤格紋。每次擷取影像時,系統都會自動套用校正係數。
Pattern Removal Auto 可讓您確保校正係數的數值適用於每次影像擷取。這些數值僅在使用「Pattern Removal Auto 」時所處的特定成像條件下才有效。
特徵#
Pattern Removal Auto 的 auto 函式在某些方面與其他 auto 函式有所不同:
啟用與使用Pattern Removal Auto#
若要使用「Pattern Removal Auto 」的自動功能:
- 將影像的 ROI設定為最大尺寸。
- 若情況允許,請確保照明均勻。
- 請停用所有可能干擾校正值生成的相機功能,例如: Gain Auto, Exposure Auto,或 Sequencer。
- 調整相機設定(例如: Exposure Time, Black Level,以及 Digital Shift)以符合需求。為獲得最佳效果,影像中的灰階值應保持均勻一致。
- 將相機中的
PatternRemovalAuto參數設為Once. - 取得 三張圖片. 請確保在各次擷取之間,目標場景不會發生變化。
相機會根據當前的成像條件生成並套用最佳校正值。此過程瞬間完成,且不會影響相機的幀率。在第三次擷取之後,PatternRemovalAuto該參數會自動設定為Off. - 如有必要,請將影像 ROI 恢復至原始尺寸。
所產生的校正值將持續適用,直至發生以下任一情況為止:
重複執行「Pattern Removal Auto 」流程#
當相關成像條件之一發生變化時,您應重複執行「Pattern Removal Auto 」流程。此舉可確保在條件改變的情況下,仍能可靠地移除檢查圖案,並避免像素值遭到不必要的變更。
相關的影像檢查條件包括以下幾項:
- 光學系統:更換鏡頭、光圈或調整焦距。
- 照明:變更照明類型、光源配置或亮度。
- 功能設定:棋盤格圖案會受到多項相機功能設定的影響,尤其是 Exposure Time, Binning、影像 ROI、 Black Level、 Digital Shift。
儲存校正值#
若相機斷電,由「Pattern Removal Auto 」自動功能所產生的校正值將會遺失。
不過,您可以將校正值儲存至一個使用者設定中。當您想再次使用這些校正值時,隨時都可以載入這個使用者設定。
載入校正值時,請確保成像條件與產生該校正值時的條件完全相同。
範例程式碼#
// Set the operating mode of the Pattern Removal Auto auto function to Once
camera.PatternRemovalAuto.SetValue(PatternRemovalAuto_Once);
// Acquire three images
// ...
// (Implement your own image grabbing routine here.
// For example, the InstantCamera class provides the StartGrabbing() method.)
// ...
// Save the correction values in User Set 1
camera.UserSetSelector.SetValue(UserSetSelector_UserSet1);
camera.UserSetSave.Execute();
INodeMap& nodemap = camera.GetNodeMap();
// Set the operating mode of the Pattern Removal Auto auto function to Once
CEnumParameter(nodemap, "PatternRemovalAuto").SetValue("Once");
// Acquire three images
// ...
// (Implement your own image grabbing routine here.
// For example, the InstantCamera class provides the StartGrabbing() method.)
// ...
// Save the correction values in User Set 1
CEnumParameter(nodemap, "UserSetSelector").SetValue("UserSet1");
CCommandParameter(nodemap, "UserSetSave").Execute();
// Set the operating mode of the Pattern Removal Auto auto function to Once
camera.Parameters[PLCamera.PatternRemovalAuto].SetValue(PLCamera.PatternRemovalAuto.Once);
// Acquire three images
// ...
// (Implement your own image grabbing routine here.
// For example, the InstantCamera class provides the StartGrabbing() method.)
// ...
// Save the correction values in User Set 1
camera.Parameters[PLCamera.UserSetSelector].SetValue(PLCamera.UserSetSelector.UserSet1);
camera.Parameters[PLCamera.UserSetSave].Execute();
/* 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 */
/* Set the operating mode of the Pattern Removal Auto auto function to Once */
errRes = PylonDeviceFeatureFromString(hdev, "PatternRemovalAuto", "Once");
CHECK(errRes);
/* Acquire three images */
/* ... */
/* (Implement your own image grabbing routine here. */
/* For example, the InstantCamera class provides the StartGrabbing() method.) */
/* ... */
/* Save the correction values in User Set 1 */
errRes = PylonDeviceFeatureFromString(hdev, "UserSetSelector", "UserSet1");
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "UserSetSave");
CHECK(errRes);
# Set the operating mode of the Pattern Removal Auto auto function to Once
camera.PatternRemovalAuto.Value = "Once"
# Acquire three images
# ...
# (Implement your own image grabbing routine here.
# For example, the InstantCamera class provides the StartGrabbing() method.)
# ...
# Save the correction values in User Set 1
camera.UserSetSelector.Value = "UserSet1"
camera.UserSetSave.Execute()
您也可以 use the pylon Viewer 來輕鬆設定參數。