×
☰ Menu

Dilation and Erosion 

Dilation and Erosion are two fundamental morphological operations. Dilation adds pixels to the boundaries of objects in an image, while erosion removes pixels on object boundaries, The number of pixels added or removed from the objects in an image depends on the size and shape of the structuring element used to process the image.

The most basic morphological operations are dilation and erosion. Dilation adds pixels to the edges of an image's objects, while erosion takes pixels away from the edges of the objects. The size and shape of the structuring element used to process the image determine how many pixels are added or removed from the objects in the image. In the morphological dilation and erosion operations, the state of any given pixel in the output image is determined by applying a rule to the corresponding pixel and its neighbors in the input image. The rule used to process the pixels defines the operation as dilation or erosion.

 

Dilation

The primary effect of dilation on binary images is to enlarge the areas of foreground pixels (i.e. white pixels) at their borders. The areas of foreground pixels thus grow in size, while the background "holes" within them shrink. With A and B as Sets in discrete space Z2 and Φ denoting the empty set, the Dilation of object A by the structuring element B is given by

The result is a new set made up of all points generated by obtaining the reflection of B about its origin and then shifting this reflection by x. The dilation of A by B then is the set of all x displacements such that reflection of B and A overlaps at least one nonzero element.

Consider the example where A is a rectangle and B is a disc centered on the origin.

The following figure shows an example of 1-D dilation.

The input signal (A)

Structuring element (B) with shaded showing the origin. Set the output to be in the intersection.

Slide the structuring element (B) along, Get the intersection for the new transitions.

Repeat this until all elements have been done.  

 

 


Erosion

The basic effect of the erosion operator on a binary image is to erode away the boundaries of foreground pixels (usually the white pixels). Thus, areas of foreground pixels shrink in size, and "holes" within those areas become larger.

For sets A and B in Z2 the erosion of the object A by a structuring element B is given by

Mathematically, the Erosion of set A by set B is a set of all points such that B translated by x is still contained in A.

To compute the erosion of a binary input image by this structuring element, we consider each of the foreground pixels in the input image in turn, for each input pixel we superimpose the structuring element on top of the input image so the origin of the structuring element coincides with the input pixel coordinates.

  1. If the input pixel is set to the foreground and all its 8 neighbors are also set to the foreground, then the pixel remains set to the foreground.
  2. If the input pixel is set to the foreground, but at least one of its & neighbors is not, the pixel is set to the background.
  3. Input pixels set to the background remain such.

A is eroded by the structuring element B to give the internal dashed shape.