Most single-chip image sensors
used in digital still and video cameras
and scanners, are overlaid with a Bayer filter
mosaic to create a color image.
This is a color filter array (CFA) arrangement of RGB color filters on a square grid of photosensors.
The filter pattern is 50% green, 25% red and 25% blue. a.k.a. RGBG, GRGB or RGGB.
Bryce Bayer of Kodak patented this in 1976.
He distinguished between:
output of Bayer-filter camera sensors is called a Bayer pattern
Each pixel records only one of three colors (Red,Green,Blue)
filtered by the Bayer filter mosaic.
A de-mosaicing algorithm is an image processing algoritm used to reconstruct a full color image from the Bayer pattern image.
It interpolates a set of complete red, green, and blue values for each point.
The de-mosaicing algorithm is part of the processing pipeline required to render these images into a viewable full-color image.
Different algorithms result in final images of varying-quality.
Of course each algorithm uses a different amount of computing power.
De-mosaicing Bayer patterns can be done in-camera, using the camera's built-in firmware to produce a JPEG or TIFF image.
Many modern digital cameras can save the raw data directly from the sensor, in a raw format.
The user may then, demosaic it themselves, outside the camera, using external software in a PC.