Image erosion

Image erosion is one of the two base operators in the area of mathematical morphology. Erosion is a process of shrinking the image's foreground or 1-valued objects. It smoothes object boundaries and removes peninsulas, fingers, and small objects.

To understand the way image erosion works, we will first try it on a simple image containing white noise, and continue with comparing the results when applied to binary and grayscale versions of a photo.