A CCD array is mechanically quite stable; the pixels have a fixed geometric relationship. Each pixel within the array, however, has unique light sensitivity characteristics. Because these characteristics affect camera performance, they must be removed through calibration. The process by which a CCD image is calibrated is known as fat felding or shading correction.
Flat fielding requires the acquisition of two calibration images. Both images must be obtained close to the time of the object exposures to be calibrated, because these images are used to provide quantitative calibration of pixel signals. If you are going to compare corrected images, all must be corrected using the same calibration images.
First, a bias or dark image is acquired. In a bias image, all of the pixels have approximately the same value, which consists of the electronic offset of the system and any inherent structure of the CCD. A dark image contains the dark signal as well as the standard bias component. A dark image is most useful for correcting long exposures with low light levels.
The flat field image measures the response of each pixel in the CCD array to illumination. The optical system introduces some variation in response. The reason being that the flat fielding process corrects for uneven illumination only if that illumination is a stable characteristic of each object exposure. The flat field image should be as representative of the background illumination as possible. The illumination should be bright enough or the exposure long enough, that the CCD pixel signals are at least 25 percent of full scale.
When a raw image is created the flat fielding technique can be applied. The flat field image is corrected for electronic offset by subtracting the bias/dark image from it. The mean pixel value of the resulting corrected flat field image is ascertained. The mean pixel value is unique to each combination of bias/dark and flat field image.
The bias/dark image is then subtracted from the exposed image. The resulting image is multiplied by the mean pixel value of the corrected flat field image and finally divided by the corrected flat field image itself. (If the corrected flat field image contains a pixel with zero value, that pixel in the corrected image is assigned a full scale value.)
The mean pixel value of the corrected image is not exactly the same as that of the raw image. However, multiplying by the mean pixel value of the corrected flat field image keeps the number more or less the same.