The Baumer GAPI shading correction (flat-field correction) helps calibrating your vision system to drastically reduce effects of brightness differences introduced by a camera/lens-system or non-even light sources.
It is not uncommon for vision systems to have variations in brightness over the full image frame for various reasons. These variations will negatively affect algorithms, like object detection or code reading, developed to enable the various tasks of a vision system.
“Flat-field correction is a technique used to improve quality in digital imaging. The goal is to remove artifacts from 2-D images that are caused by variations in the pixel-to-pixel sensitivity of the detector and/or by distortions in the optical path. It is a standard calibration procedure in everything from pocket digital cameras to giant telescopes.
Flat fielding refers to the process of compensating for different gains and dark currents in a detector. Once a detector has been appropriately flat-fielded, a uniform signal will create a uniform output (hence flat-field). This then means any further signal is due to the phenomenon being detected and not a systematic error.”
Wikipedia: https://en.wikipedia.org/wiki/Flat-field_correction [05.06.2018]
了解算法的局限性非常重要。如果一張圖像中的亮度差異超過25%到30%,可能是選擇的組件不合適,因此可以考慮更換系統組件,因為通過算法可能已經無法達到預期的效果。
注意
為了獲得理想的校準效果,應使用完整的視覺系統設置在真實環境中進行校準。
需要注意的是,校準過程中只能減少靜態影響。因此,如果在校準期間更換了鏡頭、光圈或光源,則必須重新校準視覺系統。
在設置完視覺系統并選擇所需的光圈和曝光時間設置后,本示例將介紹如何生成2個數據集:其中一個用于最暗的圖像(暗場幀),另一個用于最亮的圖像(明場幀)。
本示例將為每個數據集采集多張圖像,然后采用圖像平均法降低傳感器噪音的影響。然后,這些通過平均法得到的圖像將用于計算出校正視覺系統采集的圖像所需的數據。
準備一個干凈的白色目標物以獲取明場參考幀,在校準完成后,任何偽影(如污垢,甚至是紙張紋理)都可能出現在圖像中。白色目標物必須覆蓋需要校準的整個表面。最好選擇經過校準的目標物,但這并非硬性要求。
This is an optional step to achieve full flat-field correction. If you require just a shading correction you can skip this step. The measurement is only necessary once for a specific camera.
Notice
If a non-ideal target is used (e.g. Paper) it is possible that structures or dirt on the target are visible in the corrected image. In this case the Baumer GAPI box- and median-filters can help reduce the unwanted artefacts. The filters should only be used as a last resort as they will effect the shading-corection negatively.
Example how to use the filters:
bo_uint r = m_pShading->GetFilter(BGAPI2::Ext::Sc::Shading::BoxFilter, true);
bo_uint rMin = m_pShading->GetFilterMin(BGAPI2::Ext::Sc::Shading::BoxFilter, true);
bo_uint rMax = m_pShading->GetFilterMax(BGAPI2::Ext::Sc::Shading::BoxFilter, true);
// Set median-filter radius for light reference
m_pShading->SetFilter(BGAPI2::Ext::Sc::Shading::MedianFilter, true, 1);
// Set box-filter radius for light reference
m_pShading->SetFilter(BGAPI2::Ext::Sc::Shading::BoxFilter, true, 2);
在步驟1中獲得的參考幀現在可用于校正經校準的視覺系統采集的圖像。通常情況下,圖像校正集成到視覺應用中,本示例將介紹具體的操作。
本示例中,通過計算得到的數據可實現兩種不同的圖像校正。如果提供暗場和明場參考幀,則可計算出平場校正數據。如果僅提供明場參考幀,則只能計算出陰影校正數據。
如有任何問題,歡迎隨時聯系堡盟技術和應用支持中心。
電話:(021) 67687095
電子郵箱:[email protected]