Demosaic
   HOME

TheInfoList



OR:

A demosaicing (also de-mosaicing, demosaicking or debayering)
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
is a digital image process used to reconstruct a full color image from the incomplete color samples output from an
image sensor An image sensor or imager is a sensor that detects and conveys information used to make an image. It does so by converting the variable attenuation of light waves (as they pass through or reflect off objects) into signals, small bursts of c ...
overlaid with a
color filter array In digital imaging, a color filter array (CFA), or color filter mosaic (CFM), is a mosaic of tiny color filters placed over the pixel sensors of an image sensor to capture color information. The term is also used in reference to e paper devices ...
(CFA). It is also known as ''CFA interpolation'' or ''color reconstruction''. Most modern digital cameras acquire images using a single image sensor overlaid with a CFA, so demosaicing is part of the processing pipeline required to render these images into a viewable format. Many modern digital cameras can save images in a raw format allowing the user to demosaic them using software, rather than using the camera's built-in
firmware In computing, firmware is a specific class of computer software that provides the low-level control for a device's specific hardware. Firmware, such as the BIOS of a personal computer, may contain basic functions of a device, and may provide h ...
.


Goal

The aim of a demosaicing algorithm is to reconstruct a full color image (i.e. a full set of color triples) from the spatially undersampled color channels output from the CFA. The algorithm should have the following traits: * Avoidance of the introduction of false color artifacts, such as chromatic
aliases A pseudonym (; ) or alias () is a fictitious name that a person or group assumes for a particular purpose, which differs from their original or true name ( orthonym). This also differs from a new name that entirely or legally replaces an individu ...
, zippering (abrupt unnatural changes of intensity over a number of neighboring pixels) and
purple fringing In photography (particularly digital photography), purple fringing (sometimes called PF) is the term for an unfocused purple or magenta "ghost" image on a photograph. This optical aberration is generally most visible as a coloring and lightening ...
* Maximum preservation of the
image resolution Image resolution is the detail an image holds. The term applies to digital images, film images, and other types of images. "Higher resolution" means more image detail. Image resolution can be measured in various ways. Resolution quantifies how ...
* Low
computational complexity In computer science, the computational complexity or simply complexity of an algorithm is the amount of resources required to run it. Particular focus is given to computation time (generally measured by the number of needed elementary operations) ...
for fast processing or efficient in-camera hardware implementation * Amenability to analysis for accurate
noise reduction Noise reduction is the process of removing noise from a signal. Noise reduction techniques exist for audio and images. Noise reduction algorithms may distort the signal to some degree. Noise rejection is the ability of a circuit to isolate an u ...


Color filter array

A color filter array is a mosaic of
color Color (American English) or colour (British English) is the visual perceptual property deriving from the spectrum of light interacting with the photoreceptor cells of the eyes. Color categories and physical specifications of color are associ ...
filters in front of the image sensor. Commercially, the most commonly used CFA configuration is the
Bayer filter A Bayer filter mosaic is a color filter array (CFA) for arranging RGB color filters on a square grid of photosensors. Its particular arrangement of color filters is used in most single-chip digital image sensors used in digital cameras, cam ...
illustrated here. This has alternating red (R) and
green Green is the color between cyan and yellow on the visible spectrum. It is evoked by light which has a dominant wavelength of roughly 495570 nm. In subtractive color systems, used in painting and color printing, it is created by a combin ...
(G) filters for odd rows and alternating green (G) and
blue Blue is one of the three primary colours in the RYB colour model (traditional colour theory), as well as in the RGB (additive) colour model. It lies between violet and cyan on the spectrum of visible light. The eye perceives blue when ...
(B) filters for even rows. There are twice as many green filters as red or blue ones, catering to the
human eye The human eye is a sensory organ, part of the sensory nervous system, that reacts to visible light and allows humans to use visual information for various purposes including seeing things, keeping balance, and maintaining circadian rhythm. ...
's higher sensitivity to green light. Since the color subsampling of a CFA by its nature results in
aliasing In signal processing and related disciplines, aliasing is an effect that causes different signals to become indistinguishable (or ''aliases'' of one another) when sampled. It also often refers to the distortion or artifact that results when ...
, an optical anti-aliasing filter is typically placed in the optical path between the image sensor and the lens to reduce the false color artifacts (chromatic aliases) introduced by interpolation. Since each pixel of the sensor is behind a color filter, the output is an array of pixel values, each indicating a raw intensity of one of the three filter colors. Thus, an algorithm is needed to estimate for each pixel the color levels for all color components, rather than a single component.


Illustration

To reconstruct a full color image from the data collected by the color filtering array, a form of
interpolation In the mathematical field of numerical analysis, interpolation is a type of estimation, a method of constructing (finding) new data points based on the range of a discrete set of known data points. In engineering and science, one often has ...
is needed to fill in the blanks. The mathematics here is subject to individual implementation, and is called demosaicing. In this example, we use
Adobe Photoshop Adobe Photoshop is a raster graphics editor developed and published by Adobe Inc. for Windows and macOS. It was originally created in 1988 by Thomas and John Knoll. Since then, the software has become the industry standard not only in rast ...
's bicubic interpolation to simulate the circuitry of a Bayer filter device such as a
digital camera A digital camera is a camera that captures photographs in digital memory. Most cameras produced today are digital, largely replacing those that capture images on photographic film. Digital cameras are now widely incorporated into mobile devices ...
. The image below simulates the output from a Bayer filtered image sensor; each pixel has only a red, green or blue component. The corresponding original image is shown alongside the demosaiced reconstruction at the end of this section. A digital camera typically has means to reconstruct a whole RGB image using the above information. The resulting image could be something like this: The reconstructed image is typically accurate in uniform-colored areas, but has a loss of resolution (detail and sharpness) and has edge artifacts (for example, the edges of letters have visible color fringes and some roughness).


Algorithms


Simple interpolation

These algorithms are examples of
multivariate interpolation In numerical analysis, multivariate interpolation is interpolation on functions of more than one variable; when the variates are spatial coordinates, it is also known as spatial interpolation. The function to be interpolated is known at given poi ...
on a uniform grid, using relatively straightforward mathematical operations on nearby instances of the same color component. The simplest method is
nearest-neighbor interpolation Nearest-neighbor interpolation (also known as proximal interpolation or, in some contexts, point sampling) is a simple method of multivariate interpolation in one or more dimensions. Interpolation is the problem of approximating the value of ...
which simply copies an adjacent pixel of the same color channel. It is unsuitable for any application where quality matters, but can be useful for generating previews given limited computational resources. Another simple method is
bilinear interpolation In mathematics, bilinear interpolation is a method for interpolating functions of two variables (e.g., ''x'' and ''y'') using repeated linear interpolation. It is usually applied to functions sampled on a 2D rectilinear grid, though it can be ...
, whereby the red value of a non-red pixel is computed as the average of the two or four adjacent red pixels, and similarly for blue and green. More complex methods that interpolate independently within each color plane include
bicubic interpolation In mathematics, bicubic interpolation is an extension of cubic interpolation (not to be confused with cubic spline interpolation, a method of applying cubic interpolation to a data set) for interpolating data points on a two-dimensional regula ...
,
spline interpolation In the mathematical field of numerical analysis, spline interpolation is a form of interpolation where the interpolant is a special type of piecewise polynomial called a spline. That is, instead of fitting a single, high-degree polynomial to all ...
, and
Lanczos resampling filtering and Lanczos resampling are two applications of a mathematical formula. It can be used as a low-pass filter or used to smoothly interpolate the value of a digital signal between its samples. In the latter case it maps each sample of t ...
. Although these methods can obtain good results in homogeneous image regions, they are prone to severe demosaicing artifacts in regions with edges and details when used with pure-color CFAs. However, linear interpolation can obtain very good results when combined with a spatio-spectral (panchromatic) CFA. One could exploit simple formation models of images for demosaicing. In natural images within the same segment, the ratio of colors should be preserved. This fact was exploited in an image sensitive interpolation for demosaicing.


Pixel correlation within an image

More sophisticated demosaicing algorithms exploit the spatial and/or spectral correlation of pixels within a color image. Spatial correlation is the tendency of pixels to assume similar color values within a small homogeneous region of an image. Spectral correlation is the dependency between the pixel values of different color planes in a small image region. These algorithms include: * Variable Number of Gradients (VNG) interpolation computes gradients near the pixel of interest and uses the lower gradients (representing smoother and more similar parts of the image) to make an estimate. It is used in first versions of
dcraw dcraw is an open-source computer program which is able to read numerous raw image format files, typically produced by mid-range and high-end digital cameras. dcraw converts these images into the standard TIFF and PPM image formats. This conve ...
, and suffers from color artifacts. * Pixel Grouping (PPG) uses assumptions about natural scenery in making estimates. It has fewer color artifacts on natural images than the Variable Number of Gradients method; it was introduced in
dcraw dcraw is an open-source computer program which is able to read numerous raw image format files, typically produced by mid-range and high-end digital cameras. dcraw converts these images into the standard TIFF and PPM image formats. This conve ...
from rel. 8.71 as "Patterned Pixel Grouping". * Adaptive Homogeneity-Directed (AHD) is widely used in the industry. It selects the direction of interpolation so as to maximize a homogeneity metric, thus typically minimizing color artifacts. It has been implemented in recent versions of dcraw. * Aliasing Minimization and Zipper Elimination (AMaZE) designed by Emil J. Martinec is slow but has great performance, especially on low noise captures. Implementations of AMaZE can be found in
RawTherapee RawTherapee is application software for processing photographs in raw image formats, as created by many digital cameras. It comprises a subset of image editing operations specifically aimed at non-destructive post-production of raw photos and is ...
and
darktable Darktable (stylized as darktable) is a free and open-source photography application program and raw developer. Rather than being a raster graphics editor like Adobe Photoshop or GIMP, it comprises a subset of image editing operations specifical ...
.


Video super-resolution/demosaicing

It has been shown that super-resolution and demosaicing are two faces of the same problem and it is reasonable to address them in a unified context. Note that both these problems face the aliasing issue. Therefore, especially in the case of video (multi-frame) reconstruction, a joint super-resolution and demosaicing approach provides the optimal solution.


Trade-offs

Some methods may produce better results for natural scenes, and some for printed material, for instance. This reflects the inherent problem of estimating pixels that are not definitively known. Naturally, there is also the ubiquitous trade-off of speed versus quality of estimation.


Use in computer image processing software

When one has access to the raw image data from a digital camera, one can use computer software with a variety of different demosaicing algorithms instead of being limited to the one built into the camera. A few raw development programs, such as
RawTherapee RawTherapee is application software for processing photographs in raw image formats, as created by many digital cameras. It comprises a subset of image editing operations specifically aimed at non-destructive post-production of raw photos and is ...
, give the user an option to choose which algorithm should be used. Most programs, however, are coded to use one particular method. The differences in rendering the finest detail (and grain texture) that come from the choice of demosaicing algorithm are among the main differences between various raw developers; often photographers will prefer a particular program for aesthetic reasons related to this effect. The color artifacts due to demosaicing provide important clues for identifying photo forgeries.


See also

*
Bayer filter A Bayer filter mosaic is a color filter array (CFA) for arranging RGB color filters on a square grid of photosensors. Its particular arrangement of color filters is used in most single-chip digital image sensors used in digital cameras, cam ...


References

{{Reflist


External links

*
HowStuffWorks HowStuffWorks is an American commercial infotainment website founded by professor and author Marshall Brain, to provide its target audience an insight into the way many things work. The site uses various media to explain complex concepts, termin ...

How Digital Cameras Work, More on Capturing Color
with a demosaicing algorithm at work animation
Interpolation of RGB components in Bayer CFA images
by Eric Dubois
Color Demosaicing Using Variance of Color Differences
by King-Hong Chung and Yuk-Hee Chan
Hybrid color filter array demosaicking for effective artifact suppression
by Lanlan Chang and Yap-Peng Tan
Image Demosaicing: A Systematic Survey by Xin Li
Bahadir Gunturk and Lei Zhang
Demosaicking: Color Filter Array Interpolation in Single-Chip Digital Cameras
B. K. Gunturk, J. Glotzbach, Y. Altunbasak, R. W. Schafer, and R. M. Mersereau
Spatio-Spectral Color Filter Array Design for Enhanced Image Fidelity
Keigo Hirakawa and Patrick J. Wolfe
Effective Soft-Decision Demosaicking Using Directional Filtering and Embedded Artifact Refinement
Wen-Tsung Huang, Wen-Jan Chen and Shen-Chuan Tai
Similarity-based Demosaicking
by Antoni Buades, Bartomeu Coll, Jean-Michel Morel, Catalina Sbert, with source code and online demonstration
A list of existing demosaicing techniques

Interactive site simulating Bayer data and various demosaicing algorithms, allowing custom images
dead)

by Sira Ferradans, Marcelo Bertamio and Vicent Caselles with source code and reference paper. (dead)

(dead) Color Image sensors Digital photography