Erosion and Dilation in Image Processing
Erosion and Dilation in Image Processing
to modify the shape and size of objects in an image. Erosion shrinks foreground objects by
removing pixels from their boundaries, while dilation expands them by adding pixels. Both
operations are typically performed using a structuring element, which is a small matrix that
defines the shape and size of the neighborhood considered for each pixel. [1, 2, 3, 4, 5]
Erosion: [3, 5]
● Purpose: Erosion removes pixels from the boundaries of foreground objects, shrinking
their size and potentially enlarging holes within the objects. [3, 5]
● Mechanism: It involves comparing the structuring element with the input image. If the
structuring element is completely contained within the foreground (i.e., all its pixels are 1
in the image), the center pixel of the structuring element is set to 1 in the output.
Otherwise, it's set to 0. [1, 5, 6, 7, 8]
● Use Cases: Erosion can be used to remove small noise (salt-and-pepper noise), thin
lines, and isolate individual objects within clusters. [5, 9]
Dilation: [3, 4]
● Purpose: Dilation adds pixels to the boundaries of foreground objects, increasing their
size and potentially shrinking holes. [3, 4]
● Mechanism: It also uses a structuring element. If the structuring element overlaps with
the foreground by at least one pixel, the center pixel of the structuring element is set to 1
in the output. [1, 4, 5, 10]
● Use Cases: Dilation is useful for closing gaps, filling small holes, joining broken parts of
objects, and can be used in conjunction with erosion for noise removal and edge
detection. [6, 11]
Generative AI is experimental.
[1] https://www.youtube.com/watch?v=_LJs_Jx5yTc
[2] https://en.wikipedia.org/wiki/Erosion_(morphology)
[3] https://www.naukri.com/code360/library/difference-between-dilation-and-erosion