Main Content

Demosaic an Image

This example shows you how to demosaic a Bayer-pattern image.

Example Model

Open the Simulink® model.

modelname = "ex_blkDemosaic.slx";

The model reads an input image using an Image From File block with the File name parameter set to mandi.tif and the Sample time parameter set to inf. To demosaic the input image, the model uses a Demosaic block with the Sensor alignment set to BGGR.

Simulate the Model

Run the model. The Video Viewer blocks display the input image and the output image. You can zoom out to better inspect the images.


ans = 
                   tout: [51x1 double] 

     SimulationMetadata: [1x1 Simulink.SimulationMetadata] 
           ErrorMessage: [0x0 char]