The two principal morphological operations are dilation and erosion. Dilation allows objects to expand, thus potentially filling in small holes and connecting disjoint objects. Erosion shrinks objects by etching away (eroding) their boundaries. These operations can be customized for an application by the proper selection of the structuring element, which determines exactly how the objects will be dilated or eroded.
Most of the images acquired are in color or RGB format, which would need more processing power, memory and time to process. In a lot of cases, images could be converted to gray scale or binary for processing, which require less computing power.
In this tutorial, we are going to learn how to convert the color image to grayscale and binary image prior to the processing.