Main Content

Linearly Combine Two Images

This example shows you how to linearly combine two images using the blend operation.

Example Model

Open the Simulink® model.

modelname = 'ex_blkCompositingBlend.slx';
open_system(modelname)

This model reads two input images using Image From File blocks with their File name parameters set to peppers.png and greens.jpg, respectively.

To linearly combine two images using blend operation, the model uses these following parameters for the Compositing block:

  • OperationBlend

  • Opacity factor(s) sourceSpecify via dialog

  • Opacity factor(s)0.5

  • Location sourceSpecify via dialog

  • Location [x y][7 50]

Simulate the Model

Run the model. The Video Viewer blocks display the input images and the blended output image. You can change the Opacity factor(s) parameter to any value in the range [0, 1], and see how this affects the blended output image.

sim(modelname);