Main Content

Perform Bottom-hat Filtering of Binary Image

This example shows how to perform bottom-hat filtering on a binary image object.

Example Model

Open the Simulink® model.

modelname = 'ex_blockBottomhat.slx';

The model reads an input binary image using the Image From File block. The Bottom-hat block performs bottom-hat filtering on the input image using a disk-shaped structuring element of radius 5. The Input image type parameter of the block is set to 'Binary'. The model displays the resulted filtered image using the Video Viewer block.

Simulate and Display Results

Run the model to visualize the filtered image. The Bottom-hat block first performs the closing operation on the input image and then subtracts the input image from the result of this operation. Hence, the logo which was originally the image background, is now the white image object, as can be seen.