Morphological operations are used in image processing as a method to enhance images for further processing and also for information extraction. These operations affect the shape of the image when applied, the shape may be expanded, shrunk, thinned, or deformed. Dilation and erosion are one of these operations. Dilation is a process where the image expands depending on the structure element (or strel) used. Dilation, in Set theory is defined by,
To illustrate how Dilation works, let us look at figure 1. A is the image to be dilated and B is the strel that will be used.
Figure 1. Illustration of how Dilation works on image A with a strel B.
The second operation is the Erosion, which is the opposite of Dilation. Erosion shrinks the image depending again on what strel is used. Erosion, again in Set theory, is given by the equation,
The illustration for Erosion is shown in figure 2.
Figure 2. Illustration of how Erosion works on image A with a strel B.
In this activity, various strel's were used in Dilating and Eroding different shapes. The shapes that were used was a 5x5 square, 3x4 right triangle, 10x10 hollow square with thickness of 2, and lastly a 5 units long cross. As for the strel's, a 2x2 square, 2x1 rectangle, 1x2 rectangle, 3 units long cross and a diagonal were used. The images of the shapes and strel's used are shown below.
Shapes used
Strel's used
Figure 3. Images of the shapes and strel's used in performing Dilation and Erosion operations.
Hand-made predictions of the Dilation and Erosion results were made. The following predications are shown below.
Figure 4. Predictions of dilation results of a 5x5 square with the different strel's.
Figure 5. Predictions of erosion results of a 5x5 square with the different strel's.
Figure 6. Predictions of dilation results of a 3x4 right triangle with the different strel's.
Figure 7. Predictions of erosion results of a 3x4 right triangle with the different strel's.
Figure 8. Predictions of dilation results of a 10x10 hollow square with the different strel's.
Figure 9. Predictions of erosion results of a 10x10 hollow square with the different strel's.
Figure 10. Predictions of dilation results of a 5 units long cross with the different strel's.
Figure 11. Predictions of erosion results of a 5 units long cross with the different strel's.
Now let's try to put the shape into Scilab and apply dilate and erode function and see if our predictions match the simulations from Scilab.
Figure 12. Dilation of a 5x5 square with different strel's using Scilab.
Figure 13. Erosion of a 5x5 square with different strel's using Scilab.
Figure 14. Dilation of a 3x4 right triangle with different strel's using Scilab.
Figure 15. Erosion of a 3x4 right triangle with different strel's using Scilab.
Figure 16. Dilation of a 10x10 hollow square with different strel's using Scilab.
Figure 17. Erosion of a 10x10 hollow square with different strel's using Scilab.
Figure 18. Dilation of a 5units long cross with different strel's using Scilab.
Figure 19. Erosion of a 5units long cross with different strel's using Scilab.
We can see that the predictions and the simulations from Scilab are all similar, there are just a few that didn't really matched. Exploring other morphological functions in Scilab, let us take a look at the functions skel and thin. These functions, unlike dilate and erode, don't need strel's for morphing the images.
Figure 20. Images of the shapes after applying skel function from Scilab.
Figure 21. Images of the shapes after applying thin function from Scilab.
In this activity, morphological operations in Scilab were presented and hand-made predications were made to somehow see how does these operations work. In this activity, understanding how the dilate and erode works is a bit tricky, but once you understand them, excitement comes in, specially when predicting the simulation results. I would give myself a grade if 10 for this activity.
Reference:
Dr. Soriano. Applied Physics 186 Activity Manual: A9 - Morphological Operations. 2010.
No comments:
Post a Comment