![]()
Image borrowed from Wikipedia
As a kid, I grew up playing Tetris. Though the game is at least 4 years older than I am, it was in my childhood days when became popular and at the same time very accessible to the public. The game was ported to numerous different hand-helds and personal computers. Having played the game in different consoles and computers, I have always been fascinated with the differently shaped but nearly same sized polygons and how they would fit beside and in between one another.
But just imagine my shock when last year, I was introduced to Giga Tetris. Yes, Giga, because besides having the normally sized polygons, the gameplay also incorporates enlarged polygons into the level, greatly adding to the challenge and excitement. (For more shocking Tetris, see here: Hell)
Of course, we can see that the larger polygons are simply twice the size of the regular polygons. But being hardcore physicists, we can make things more complicated (and more interesting!) than that.
Since we are talking about polygons or shape, we are basically talking about morphology. What we call the operations to enhance our shapes are morphological operations.
Today, we would be learning about the basic morphological operations erode and dilate. And how do we learn about a theoretical topic with physical implications? By doing of course.
My theoretical capabilities are not that high, so I’m going to explain erosion and dilation in my own words.
Firstly, we need to know two key terms: the object and the structuring element. Basically, the object is the shape that you want to operate on. It could be any shape that you want. On the other hand, the structuring element is the shape that you want to apply to the object. On how we want to apply this shape we would be talking about in the next paragraphs.
Erosion
Erosion is basically laying over a structuring element on the object. Afterwards you compare the pixels of the structuring element and depending on where you weighted the structuring element. If the structuring element is inside the object with respect to the pixel, you erase that pixel.
Dilation
Dilation is the opposite of erosion. Rather than erasing pixels that are not encompassed by the object, you apply the structuring element on every pixel of the object, effectively enlarging the object. So in terms of Giga Tetris, our enlarged shapes are simply dilated shapes. ;)
To test our understanding of erosion and dilation, we created 5 different objects and 4 different structuring elements with the help of Adobe Photoshop and its pixel grid. The objects were plotted pixel by pixel, and then the structuring elements were manually compared and then applied through erosion and dilation.

The objects upon performing manual erosion with the given structuring elements.

The objects upon performing manual dilation with the given structuring elements.
Of course, to see if what we did using manual comparison is correct, we simulated erosion and dilation using Scilab. Matrices of the object were created, with the objects and structuring elements having values of one so that they would be white. Erosion and dilation were performed using their respective functions.

The objects upon performing simulated erosion with the given structuring elements.

The objects upon performing simulated dilation with the given structuring elements.
Save for a few objects with extra or missing pixels, I can say that my manual erosion and dilation are correct.
Other operations
Well, besides erosion and dilation, there are other morphological operations for us to take advantage of. Here we will be exploring close, open, thin, and skel.
Close
Closing is basically dilating and then eroding the object. This is done to eliminate the holes that are present inside. By dilating the object, we enlarge the object with the given structuring element. By enlarging, we mean the edges outside the shape and edges inside the shape. So this takes care of the holes. To get back the original shape, we then subject the object to erosion, and the previously applied structuring elements get removed.
Open
Opening on the other hand operates by eroding and then dilating the object. This is done to remove different objects depending on what you need. What happens is by first eroding, objects that are smaller than the structuring element gets erased. For example in the simulations above, the cross was eliminated by eroding the cross with a 2×2 matrix. After doing this, the objects are then dilated to reverse the previous erosion, reverting to the other original objects without the unwanted objects.
Thin
Thin basically removes the boundaries of the object, keeping lines of a single pixel that resemble the original object.
Skel
Skel is like thin, but does not allow for the single pixel lines to be disconnected.

Comparison of skel and thin using MATLAB. Notice the protrusions along the image applied with skel.
Conclusion.
In this activity, we learned how to do different morphological operations. But what are the importance of these operations? Morphological operations are pre-processing steps when you analyze your images. They enhance our view of the images by erasing unwanted points or separating different objects.
This activity was very very long, as we can see in the above there were a lot of manual comparison and simulations done, hence the length before submission.
I give myself a grade of 10/10 for being able to produce the results and showing understanding of the topic.
Acknowledgements
Ma’am Jing, Dennis Diaz, Arvin Mabilangan for answering my questions. :)
Cindyleen Grieta for helping me with the organization of my figures.
Jonathan Abat for being lively.
References.
[1] Soriano, Maricor, “A9 – Morphological Operations”
[2] Morphological operations on binary images - MATLAB (www.mathworks.com/access/helpdesk/help/toolbox/images/bwmorph.html)

