This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

vision.DemosaicInterpolator System object

Bayer-pattern image conversion to true color


The DemosaicInterpolator object demosaics Bayer's format images. The object identifies the alignment as the sequence of R, G, and B pixels in the top-left four pixels of the image, in row-wise order.


Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


H = vision.DemosaicInterpolator returns a System object, H, that performs demosaic interpolation on an input image in Bayer format with the specified alignment.

H = vision.DemosaicInterpolator(Name,Value) returns a System object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1, Value1,...,NameN,ValueN).



Interpolation algorithm

Specify the algorithm the object uses to calculate the missing color information as one of Bilinear | Gradient-corrected linear. The default is Gradient-corrected linear.


Alignment of the input image

Specify the sequence of R, G and B pixels that correspond to the 2-by-2 block of pixels in the top-left corner, of the image. It can be set to one of RGGB |GRBG | GBRG | BGGR. The default is RGGB. Specify the sequence in left-to-right, top-to-bottom order.

 Fixed-Point Properties


stepPerform demosaic operation on input
Common to All System Objects

Create System object with same property values


Expected number of inputs to a System object


Expected number of outputs of a System object


Check locked states of a System object (logical)


Allow System object property value changes


Demosaic a Bayer pattern encoded-image photographed by a camera with a sensor alignment of BGGR.

 x = imread('mandi.tif');
 hdemosaic = ...
     vision.DemosaicInterpolator('SensorAlignment', 'BGGR');
 y = step(hdemosaic, x);

 title('Original Image');
 figure, imshow(y,'InitialMagnification',20); 
 title('RGB image after demosaic');


This object implements the algorithm, inputs, and outputs described on the Demosaic block reference page. The object properties correspond to the block parameters, except:

The Output image signal block parameter allows you to specify whether the block outputs the image as One multidimensional signal or Separate color signals. The object does not have a property that corresponds to the Output image signal block parameter. The object always outputs the image as an M-by-N-by-P color video signal.

Extended Capabilities

Introduced in R2012a