Flat-Field Correction#
Before flat-field correction can be applied, the camera needs to be calibrated. This involves calculating appropriate correction data and uploading these to the camera. With this, the original pixels can be corrected during image acquisition resulting in an improved image.
This feature is complemented by the Flat-Field Correction (pylon Viewer) feature.
機能を使用する#
仕組み#
Every sensor's pixels vary slightly in their brightness output resulting in image artifacts. This is a common effect in digital imaging. Flat-field correction minimizes these image artifacts, thus improving image quality and subsequent analysis.
To remove image artifacts, you must first create correction data. The following diagram illustrates this process:
手順1–補正値(CV)の作成#
手順2–フラットフィールド補正の適用#
Step 1 requires a sequence of dark field images to detect dark signal non-uniformities (DSNU) (dark current noise) and a sequence of bright field (flat field) images to detect photo response non-uniformities (PRNU).
次に、ユーザーが補正値(CV)を計算し、カメラのフラッシュメモリーに保存する必要があります。
In step 2, the image artifacts are removed, provided that the flat-field correction feature is enabled. The original pixel values (OV) are corrected resulting in an improved image (Resulting Values, RV).
Calculating the Correction Values Using the pylon Viewer#
→ See Flat-Field Correction (pylon Viewer).
Calculating the Correction Values Using the pylon API#
The Flat-Field Correction feature is column-based, i.e., for each column of the sensor, a correction value for Dark Signal Non-Uniformity (DSNU) and a correction value for Photo Response Non-Uniformity (PRNU) must be calculated during calibration. The following mathematical parameters are involved:
- DMean:暗視野画像のすべてのピクセルの平均グレー値
- GMean:明視野画像のすべてのピクセルの平均グレー値
- DSNU_Coeff(x): dark signal non-uniformity (DSNU) coefficient
- PRNU_Coeff(x):フォト応答不均一性(PRNU)係数
- UserGD_Offset:ユーザー定義のグローバルダークオフセット
xは列インデックスです。
情報
For best results, acquire the dark and bright field images in your actual application environment. Be aware that only static effects can be corrected. If you change, e.g., the lens or lighting, you must repeat this procedure.
補正値を計算するには:
- レンズにプラスチック製のキャップを付けてセンサーを光から保護し、一連の暗い画像を取得します。
- 取得したすべての画像のすべてのピクセルのグレー値を合計し、合計をピクセルの総数で割り算します。結果は、暗視野画像(DMean)内のすべてのピクセルの平均グレー値です。
- 各列x(D(x))の平均グレー値を計算します。
- Illuminate the sensor homogenously to 70 % saturation, e.g., by placing a white sheet of paper in the camera's entire field of view, and acquire a sequence of bright images.
- 取得したすべての画像のすべてのピクセルのグレー値を合計し、合計をピクセルの総数で割り算します。結果は、明視野画像(GMean)内のすべてのピクセルの平均グレー値です。
- 各列x(G(x))の平均グレー値を計算します。
- 必要な場合、必要に応じてグローバルダークオフセット値を決定します(UserGD_Offset)。
-
For each column x, calculate the coefficients DSNU_Coeff(x) and PRNU_Coeff(x) as follows:
-
計算値を使用して、pylon APIを介して対応するカメラパラメーターを設定します。
- 列インデックス(x):
BslFlatFieldCorrectionCoeffX
- Dmean:
BslFlatFieldCorrectionDMean
- DSNU_Coeff(x):
BslFlatFieldCorrectionCoeffDSNU
- PRNU_Coeff(x):
BslFlatFieldCorrectionCoeffPRNU
- UserGD_Offset:
BslFlatFieldCorrectionUserGD
- 列インデックス(x):
-
すべての列にすべての補正値を設定したら、一連の画像を取得してフラットフィールド補正をテストできます。
- If you're satisfied with the image quality, save the settings to the camera's flash memory by executing the
BslFlatFieldCorrectionSaveToFlash
command.
フラットフィールド補正モードの設定#
フラットフィールド補正モードを設定するには、BslFlatFieldCorrectionMode
パラメーターを次のいずれかの値に設定します。
On
: The camera performs flat-field correction, i.e., DSNU and PRNU corrections.DSNUOnly
: The camera performs DSNU correction only.Off
(デフォルト):カメラはフラットフィールド補正を実行しません。
外部リンク#
サンプルコード#
// Example: Set all correction values for all columns
// Dark signal non-uniformity (DSNU) coefficient
// CalculatedDSNU[0..width-1]
// Photo response non-uniformity (PRNU) coefficient
// CalculatedPRNU[0..width-1]
for (x=0; ++x; x<width)
{
camera.BslFlatFieldCorrectionCoeffX.SetValue(x);
camera.BslFlatFieldCorrectionCoeffDSNU.SetValue(CalculatedDSNU[x]);
camera.BslFlatFieldCorrectionCoeffPRNU.SetValue(CalculatedPRNU[x]);
}
// Set the global dark offset value
camera.BslFlatFieldCorrectionUserGD.SetValue(40)
// Save the settings to the camera's flash memory
camera.BslFlatFieldCorrectionSaveToFlash.Execute();
// Set the flat-field correction mode
camera.BslFlatFieldCorrectionMode.SetValue(BslFlatFieldCorrectionMode_On);
このサンプルコードは、C++言語でのみ使用できます。
pylon Viewerを使用して、パラメーターを簡単に設定することもできます。