Main Content

Adjust Contrast of Image

This example shows you how to adjust the contrast of an image by linearly scaling pixel values.

Example Model

Open the Simulink® model.

modelname = "ex_blkcontrastadjustment.slx";
open_system(modelname);

This model reads an input image using an Image From File block with the File name parameter set to pout.tif.

To adjust the contrast of the image by linearly scaling pixel values, the model uses a Contrast Adjustment block.

Simulate the Model

Run the model. The Video Viewer blocks displays the input image and the contrast-adjusted output image.

sim(modelname);