Main Content

Dilation of Binary Image

This example shows how to increase the size of a binary image object and fill holes in it.

Example Model

Open the Simulink® model.

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

The model reads an input binary image using the Image From File block. The Dilation block dilates the input image using a 5-pixel wide square structuring element. The model displays the resulting dilated image using the Video Viewer block.

Simulate and Display Results

Run the model to visualize the dilated image. The Dilation block fills the holes in the white object and also increases its size.

sim(modelname);