Package com.openinventor.imageviz.engines.mathematicalmorphology.erosionanddilation

Introduction to Erosion

In an erosion, pixel values within the structuring element are set to the minimum value of the element. In a binary image, an erosion removes isolated points and small particles, shrinks other particles, discards peaks at the object boundaries, and disconnects some particles.

Erosion modules are reiterative: repeating an erosion or dilation of size 1 N times has the same effect as performing a single erosion with a structuring element of size N.

In Figure 4 the binary image is I, and X denotes the set of points with a value of 1. The erosion of I by the structuring element B results in the set of points x, where the disk representing B and cenetred on x is totally included in the set of points X. The erosion of I can be denoted as or .

Figure 4: Erosion applied to a binary image The eroded set of X by the structuring element B is:

It may also be written as:

The value of the structuring element (B) varies depending on the type of erosion. On a gray level image, the erosion by the structuring element B is the search for the minimal value of intensities within B.

  • 2D image : .
  • 3D image : .

When the point hits the edge of the image, the structuring element is composed of the intersection of B with the points of the structuring element totally within the image, and not the points outside the image.

Introduction to Dilation

In a dilation, pixel values within the disc are set to the maximum value of the pixel neighborhood. In a binary image, a dilation fills the small holes inside particles and gulfs at the object boundaries, enlarges the size of the particles and may connect neighboring particles.

Dilation modules are reiterative: repeating an erosion or dilation of size 1 N times has the same effect as performing a single erosion with a structuring element of size N.

In Figure 5, the binary image is I, and X denotes the set of points with a value of 1. The dilation of I by the structuring element B results in the set of points x, where the disc representing B and centered on x has a non empty intersection with the set of points X. The dilation of I can be denoted as or .

Figure 5: Dilation applied to a binary image The dilated set of X by the structuring element B is:

It may also be expressed as:

The value of the structuring element (B) varies depending on the type of erosion. On a gray level image, the dilation by the structuring element B is the search for the maximum value of intensities within B:

  • 2D image : .
  • 3D image : .

When the point hits the edge of the image, the structuring element is composed of the intersection of B with the points of the structuring element totally within the image, and not the points outside the image.