Morphological operators use a structuring element to modify an image. What is a structuring element? A structuring element is basically a small shape that can be used to inspect a small region in the image. It is positioned at all the pixel locations in the image so that it can inspect that neighborhood. We basically take a small window and overlay it on a pixel. Depending on the response, we take appropriate action at that pixel location.
Let's consider the following input image:
We are going to apply a bunch of morphological operations to this image to see how the shape changes.