Morphological operations are often used as pre or post-processing tool in image processing. It is applied to binary images and are used to either for thinning, filtering or pruning. It is also used to get a representation of the shape of an object or regions such as boundaries, skeletons, convex hulls and the likes.
The two principal methods of the morphological operation are the erosion and dilation. Erosion basically shrinks the objects into smaller dimensions by eroding some components at the boundaries. Dilation, on the other hand, performs the opposite. It expands the object by filling in holes and connecting the disjoint objects. The extent to which the objects are shrank or expanded are dependent on the structuring element used. Structuring elements can be of any shape.
Mathematically, the dilation of A by B is defined as [1]:
where B is the structuring element. It is illustrated by the following figure:
Figure 1. Dilation of A by B obtained from [1]
Meanwhile, erosion is mathematically defined by the following operator [1]:
where B is again the structuring element. The illustration of erosion is shown in the figure below.
Figure 2. Erosion of A by B obtained from [1]
Notice from figure 1 and 2 that the effect of structuring element to A and B are to elongate and to shrink respectively. Given different figures (A) and structuring elements (B), we are tasked to perform morphological operations erosion and dilation. A picture of my hand-drawn result is shown below:
Figure 3. Hand-drawn result of the morphological operation erosion and dilation
Note that the blank areas (erosion part) corresponds to absence of the object itself. This means that it is possible that the object will be annihilated by the structuring element when performing erosion.
Let's now compare the result of the morphological operation performed using Scilab. The erosion and dilation results for the 5 by 5 square is shown in the following figure where the structuring elements are the blue colored ones.
Figure 4. Inverted result of the morphological operation performed on a 5x5 square and a cross using Scilab
Since in Scilab, the value equal to 1 is white and 0 is black, the result shown in figure 4 is inverted for easier matching to my hand-drawn predictions. Additional results are shown in Figure 5.
Figure 5. Inverted result of the morphological operation applied on a hollow square and a triangle using Scilab
Comparing my hand-drawn predictions to the actual results, we could observe a few mistakes. I apologize for those mistakes, I must have been really in a hurry when I did it. For this activity, I give myself a grade of 10/10 for doing all the required task.
[1] Maricor Soriano. Morphological Operation activity Manual
[2] Morphological Operations on Binary images from http://users.utcluj.ro/~raluca/ip_2013/ipl_07e.pdf
Walang komento:
Mag-post ng isang Komento