Opentopia Directory Encyclopedia Tools

Demosaicing

Encyclopedia : D : DE : DEM : Demosaicing


A demosaicing algorithm is a digital image process used to interpolate a complete image from the partial raw data received from the color-filtered image sensor internal to many digital cameras in form of a matrix of colored pixels. Also known as CFA interpolation or color reconstruction, another common spelling is demosaicking.

Many modern digital cameras provide the RAW file, e.g. Nikon provides the "NEF" file, and the end user can demosaic it, rather than using the camera's firmware. Mosaicing refers to the process of undoing the in-camera interpolation, recovering the RAW data from a JPEG image, and is usually done by reverse engineering the camera.

Goal

The Bayer filter mosaic. Each four by four submosaic contains 2 green, 1 blue and 1 red pixel
The Bayer filter mosaic. Each four by four submosaic contains 2 green, 1 blue and 1 red pixel

There are a number of different ways the pixels are arranged in practice, the most common being the Bayer filter similar to the image at right, alternating values of Red (R) Green (G) for odd rows and alternating values of Green (G) and Blue (B) for even rows.

Since each raw pixel of the sensor is behind a color filter, the output is a mosaic of monochrome pixels in one of the color components (e.g. red, green, or blue). Thus, an algorithm is needed to estimate for each pixel the color levels for all color components, rather than a single component.

Tradeoffs

Some methods may produce better results for natural scenes, and some for printed material, for instance. This reflects the inherent problem in estimating pixels that we do not really know for certain.

Naturally there is also the ubiquitous tradeoff of speed versus quality of estimation.

Illustration

To reconstruct a color image from the data collected by the color filtering array, you need to fill up the blanks. The mathematics here is subject to individual implementation, and is called demosaicing. If you have a RAW image, you can use different demosaicing than what is built into the camera, often yielding higher quality.

In this example, we use Adobe Photoshop's bicubic interpolation to simulate the circuitry of a Bayer filter device such as a digital camera. In a typical commercial implementation, low pass anti-alias filters will be added that make the artifacts shown here less pronounced, with a corresponding reduction of sharpness.

shades_aa.jpg

This is the original image, made with Adobe Illustrator. On a perfect digital camera with perfect optical lens that can measure every pixel's exact Red, Green, and Blue components, the resulting image will probably look like this.

shades_bayer.png

This is a simulated sampling taken by a Bayer filtered sensor array. Each pixel only has a value of either R or G or B.

200px
Frame enlargement
200px 200px 200px
Red Green Blue

A digital camera has certain circuits to reconstruct the whole image using above information. The resulting image could be something like this:

shades_dc.jpg

200px 200px
Frame enlargement of the original. Frame enlargement of the reconstructed image.

The reconstructed image is accurate in low contrast areas. However, the edges of letters have visible colored artifacts, and a rough appearance.

Algorithms

Quick (Low-Grade)

Simple interpolation

These are relatively straightforward mathematical operations using only nearby instances of the same color component. The simplest is the bilinear interpolation method. In this method, the red value of a non-red pixel is computed as the average of the adjacent red pixels, and similar for blue and green.

Synthetic field based interpolation

These are algorithms that first compute an alternate representation, and use that to interpolate the color components.

Adaptive

These algorithms adapt their method of estimation (i.e. the estimation formula) depending on features of the area surrounding the pixel of interest.

Proprietary

Various commercial products implement proprietary estimation methods about which little is publicly known, and which may or may not be similar to publicly known algorithms.

Examples:

External links

 


From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.

Search Titles
0123456789
ABCDEFGHIJ
KLMNOPQRST
UVWXYZ?

E-mail this article to:

Personal Message: