Main Content

Perform Opening of Binary Image

This example shows how to break narrow bridges between two main sections of a binary image object and eliminate thin protruding elements.

Example Model

Open the Simulink® model.

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

The model reads an input binary image using the Image From File block. The Opening block performs the opening operation on the input image using a disk-shaped structuring element with a radius of 4. The model displays the resulted opened image using the Video Viewer block.

Simulate and Display Results

Run the model to visualize the opened image. The Opening block eliminates the narrow connecting bridge and the thin protrusions of the white object, as can be seen.

sim(modelname);