The Flat-Field Correction (FFC) camera feature allows you to remove non-uniformities in the image caused by differing light sensitivities of the sensor pixels.
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.
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:
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).
The correction values (CV) must then be calculated by the user and saved to the camera's flash memory.
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#
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: mean gray value of all pixels in the dark field image
GMean: mean gray value of all pixels in the bright field image
DSNU_Coeff(x): dark signal non-uniformity (DSNU) coefficient
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.
To calculate the correction values:
Protect the sensor from light, e.g., by placing a plastic cap on the lens, and acquire a sequence of dark images.
Sum up the gray values of all pixels in all acquired images and divide the sum by the total number of pixels. The result is the mean gray value of all pixels in the dark field image (DMean).
Calculate the mean gray value for each column x (D(x)).
Illuminate the sensor homogeneously 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.
Sum up the gray values of all pixels in all acquired images and divide the sum by the total number of pixels. The result is the mean gray value of all pixels in the bright field image (GMean).
Calculate the mean gray value for each column x (G(x)).
If necessary, determine a global dark offset value according to your needs (UserGD_Offset).
For each column x, calculate the coefficients DSNU_Coeff(x) and PRNU_Coeff(x) as follows:
Use the calculated values for setting the corresponding camera parameters via the pylon API.
Column index (x):BslFlatFieldCorrectionCoeffX
DMean:BslFlatFieldCorrectionDMean
DSNU_Coeff(x):BslFlatFieldCorrectionCoeffDSNU
PRNU_Coeff(x):BslFlatFieldCorrectionCoeffPRNU
UserGD_Offset:BslFlatFieldCorrectionUserGD
After having set all correction values for all columns, you can test flat-field correction by acquiring a series of images.
If you're satisfied with the image quality, save the settings to the camera's flash memory by executing the BslFlatFieldCorrectionSaveToFlash command.
// 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 valuecamera.BslFlatFieldCorrectionUserGD.SetValue(40)// Save the settings to the camera's flash memorycamera.BslFlatFieldCorrectionSaveToFlash.Execute();// Set the flat-field correction modecamera.BslFlatFieldCorrectionMode.SetValue(BslFlatFieldCorrectionMode_On);
This sample code is only available in C++ language.