demosaic
Convert Bayer image to truecolor image
Syntax
Description
converts the Bayer image, RGB
= demosaic(bayer
,sensorAlignment
)bayer
, to the
truecolor image, RGB
. The
sensorAlignment
argument specifies the
Bayer pattern.
A Bayer filter mosaic is a type of color filter array (CFA), or an arrangement of color filters on the photosensors of a single-chip digital camera. The color filters let each photosensor record only red, green, or blue data. A Bayer pattern is the repeating arrangement of the four color filters, consisting of two green, one red, and one blue filter, that comprise the Bayer filter mosaic.
A Bayer pattern image, or Bayer image, is the image captured by a camera with a Bayer filter mosaic. Demosaicing a Bayer image consists of combining the signals from the photosensors to form a 3-channel truecolor image, rather than a single-channel intensity image.
also specifies the actual bit depth,
RGB
= demosaic(bayer
,sensorAlignment
,BitsPerSample=bitsPerSample
)bitsPerSample
, of the input Bayer
image. Use this syntax when the data contains fewer bits than the
data type (since R2025a).
Examples
Input Arguments
Output Arguments
Algorithms
The demosaic
function uses gradient-corrected linear
interpolation to convert the two-dimensional Bayer image into the truecolor
image.
References
[1] Malvar, H.S., L. He, and R. Cutler, High quality linear interpolation for demosaicing of Bayer-patterned color images. ICASPP, Volume 34, Issue 11, pp. 2274-2282, May 2004.