Intel® Integrated Performance Primitives Developer Guide and Reference

ID 790148
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Morphological Operations

This chapter describes the Intel® IPP image processing functions that perform morphological operations on images.

Generally, the erosion and dilation smooth the boundaries of objects without significantly changing their area. Opening and closing smooth thin projections or gaps. Morphological operations use a structuring element (SE) that is a a user-defined rectangular mask, or for some functions - symmetric 3x3 mask.

In a more general sense, morphological operations involve an image A called the object of interest and a kernel element B called the structuring element. The image and structuring element could be in any number of dimensions, but the most common use is with a 2D binary image, or with a 3D gray scale image. The element B is most often a square or a circle, but it could be of any shape. Just like in convolution, B is a kernel or template with an anchor point. Figure "Dilation and Erosion of A by B" shows dilation and erosion of object A by B. In the figure, B is rectangular with an anchor point at upper left shown as a dark square.

Dilation and Erosion of A by B



Let Bt is the SE with pixel t in the anchor position, B is transpose of the SE.

Dilation of binary image A {A(t) = 1, tA; 0 - otherwise} by binary SE B is



It means that every pixel is in the set, if the intersection is not null. That is, a pixel under the anchor point of B is marked “on”, if at least one pixel of B is inside of A.

Erosion of the binary image A by the binary SE B is



That is, a pixel under the anchor of B is marked “on”, if B is entirely within A.

Generalization of dilation and erosion for the gray-scale image A and the binary SE B is



Generalization of dilation and erosion for the gray-scale image A and the gray-scale SE B is



Opening operation of A by B is AB = (AΘB) B.

Closing operation of A by B is AB = ( AB) ΘB.

Top-hat operation of A by B is A - AºB.

Black-hat operation of A by B is AB - A.

Black-hat operation of A by B is AB - AΘB.

Morphological reconstruction [Vincent93]ρA(C) of an image A from the image C, A(t) C(t) t by dilation with the mask B is an image



Morphological reconstruction ρA(C) of an image A from the image C, A(t) C(t) t by erosion with the mask B is an image



Figure "Morphological Operations Performed by Intel IPP" presents the results of different morphological operations applied to the initial image. In these operations, the SE is a matrix of 3x3 size with the following values:



for common and advanced morphology, and



for gray morphology.

The anchor cell is in the center cell (1,1) of the matrix.

Morphological Operations Performed by Intel IPP



Flat Structuring Elements for Grayscale Image

Erosion and dilation can be done in 3D space, that is, with gray levels. 3D structuring elements can be used, but the simplest and the best way is to use a flat structuring element B. Figure "1D Cross Section of Dilation and Erosion of A by B" is a 1D cross section of dilation and erosion of a grayscale image A by a flat structuring element B. In the figure, B has an anchor slightly to the right of the center as shown by the dark mark on B.

1D Cross Section of Dilation and Erosion of A by B



In Figure "1D Cross Section of Dilation and Erosion of A by B" above, dilation is mathematically



and erosion is



.