What is Flat Field Correction?
The Flat-field correction (FFC) is a method used to correct:
● | the differences of light sensitivity between the pixel sensors of a camera |
● | the differences of illumination intensities in the field-of-view |
● | the differences in the transmission of light through the lens (for instance: vignetting) |
The goal is to correct the pixels of the captured (raw) images in such a way that when a uniform background is captured by the system (camera & lens), the resulting output image is uniform.

This correction is achieved by applying the following operation to each pixel of the raw image:
CorrectedPixel = (RawPixel - Offset) * Gain
where both Offset
and Gain
coefficients are specific values for each pixel.

The calibration procedure evaluates the Offset
and Gain
FFC coefficients of each pixel by computing pixel data of two reference images: the Dark Image and the Flat Image
Important: the calibration procedure must be redone if any part of the system is changed, including the camera unit, lighting or optics equipment.
Dark Image Acquisition
The dark image (a.k.a. dark frame) is an image captured in the dark. Such image represents the dark current of the sensors, and is considered as a fixed bias that we want to eliminate when acquiring images in normal conditions. To obtain the dark image:
1. | Cover the lens with a cap. |
2. | Acquire several images and compute the average response for each pixel of the array |
Flat Image Acquisition
The flat image is an image of a uniform target covering the whole field-of-view. To obtain the flat image:
1. | Place a uniform target (white for color cameras) wide enough to cover the whole field-of-view |
2. | Adjust the lens aperture and the illumination intensity to obtain the brightest possible image providing that no pixels are saturated. |
3. | Acquire several images and compute the average response for each pixel of the array |
FFC Offset Coefficients Calculation
For each pixel, the Offset coefficient is actually the pixel value of the Dark Image.
Note: This correction is also called dark-frame subtraction.
FFC Gain Coefficients Calculation
The Dark Image and the Flat Image provide enough data to compute the Gain
coefficients of the FFC.
For this we define CorrectedPixel
as the pixel value we consider to be correct for the flat image. Let's set this value as the average pixel value of the flat image (average(Flat)
), corrected by the average of the dark image (average(Flat)
). In the FFC terms, this gives:
average(Flat) - average(Dark) = (FlatPixel - DarkPixel) * Gain
This leads to the Gain
value
Gain = (average(Flat) - average(Dark)) / (FlatPixel - DarkPixel)
The same computation is repeated (width
* height
) times, to cover all pixels of both flat and dark images. This results in a specific correction for each pixel of the image.

For color pixel formats, we have several ways of computing the value of average(Flat)
. In all cases, the Gain
computation is repeated (width
* height
* componentsPerPixel
) times to cover all pixel components, which results in specific corrections for each pixel component of the image.
Handling pixel components individually
I.e. in RGB
:
● | using average(Flat[Red]) for computing the Gain values of Red components; |
● | using average(Flat[Green]) for computing the Gain values of Green components; |
● | using average(Flat[Blue]) for computing the Gain values of Blue components. |
Handling pixel components together
I.e. in RGB
, using average(average(Flat[Red]), average(Flat[Green]), average(Flat[Blue]))
for computing the Gain
values of Red
, Green
and Blue
components.
This way of computing the average (i.e. over the pixel components) results in FFC coefficients that also correct the balance between components. Therefore, depending on the quality of the uniform background used to acquire the flat image, the FFC can effectively perform a white balance correction.