Erosion is one of the two basic operators in the area of mathematical morphology, the other being dilation. It is typically applied to binary images, but there are versions that work on grayscale images. The basic effect of the operator on a binary image is to erode away the boundaries of regions of foreground pixels (i.e. white pixels, typically). Thus areas of foreground pixels shrink in size, and holes within those areas become larger.
To compute the erosion of a binary input image by this kernel, we consider each of the foreground pixels in the input image in turn. For each foreground pixel (which we will call the input pixel) we superimpose the kernel on top of the input image so that the origin of the kernel coincides with the input pixel coordinates. If for every pixel in the kernel, the corresponding pixel in the image underneath is a foreground pixel, then the input pixel is left as it is. If any of the corresponding pixels in the image are background, however, the input pixel is also set to background value.
The figures below illustrate the operation of an erosion. The figure on the
left shows objects in a binary image. The figure on the right shows the same
objects after erosion with the kernel in the center(origin in blue).
Grayscale erosion with a flat disk shaped kernel will generally darken the image. Bright regions surrounded by dark regions shrink in size, and dark regions surrounded by bright regions grow in size. Small bright spots in images will disappear as they are eroded away down to the surrounding intensity value, and small dark spots will become larger spots. The effect is most marked at places in the image where the intensity changes rapidly, and regions of fairly uniform intensity will be left more or less unchanged except at their edges. Figure 3 shows a vertical cross-section through a graylevel image and the effect of erosion using a disk shaped kernel. Note that the flat disk shaped kernel causes small peaks in the image to disappear and valleys to become wider.
The figures below illustrate the operation of an erosion. The figure on the left shows the umbra of a line in a grayscale image. The figure on the right shows the umbra of the same line after erosion with the kernel in the center(origin in the middle)
.