# Flat-field correction

Not to be confused with Petzval field curvature, which refers to focus uniformity.
The brightness variation due to vignetting, as shown here, can be corrected by selectively brightening the perimeter of the image.

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.

A flat-field consists of two numbers for each pixel, the pixel's gain and its dark current (or dark frame). The pixel's gain is how the amount of signal given by the detector varies as a function of the amount of light (or equivalent). The gain is almost always a linear variable, as such the gain is given simply as the ratio of the input and output signals. The dark-current is the amount of signal given out by the detector when there is no incident light (hence dark frame). In many detectors this can also be a function of time, for example in astronomical telescopes it is common to take a dark-frame of the same time as the planned light exposure. The gain and dark-frame for optical systems can also be established by using a series of neutral density filters to give input/output signal information and applying a least squares fit to obtain the values for the dark current and gain. $C = {{(R - D)*m}\over{(F-D)}} = {(R-D)*G}$

where:

• C = corrected image
• R = raw image
• F = flat field image
• D = dark field or dark frame
• m = average value of (F-D)
• G = Gain = $m\over(F-D)$[1]

In this equation, capital letters are 2D matrices, and lowercase letters are scalars. All matrix operations are performed element-by-element.

In order for an astrophotographer to capture a light frame, he or she must place a light source over the imaging instrument's objective lens such that the light source emanates evenly through the users optics. The photographer must then adjust the exposure of their imaging device (CCD or DSLR camera) so that when the histogram of the image is viewed, a peak reaching about 40–70% of the dynamic range (Maximum range of values for a changeable quantity. In this case its pixel value) of the imaging device is seen. The photographer typically takes 15–20 light frames and performs median stacking. Once the desired light frames are acquired, the objective lens is covered so that no light is allowed in, then 15–20 dark frames are taken, each of equal exposure time as a light frame. These are called Dark-Flat frames.