Opening
-
It is obtained by the erosion of an image followed by a dilation.
-
Useful for removing small objects (it is assumed that the objects are bright on a dark foreground)
-
For instance, check out the example below. The image at the left is the original and the image at the right is the result after applying the opening transformation. We can observe that the small spaces in the corners of the letter tend to dissapear.
Closing
-
It is obtained by the dilation of an image followed by an erosion.
-
Useful to remove small holes (dark regions).
Morphological Gradient
-
It is the difference between the dilation and the erosion of an image.
-
It is useful for finding the outline of an object as can be seen below:
Top Hat
-
It is the difference between an input image and its opening.
Black Hat
-
It is the difference between the closing and its input image