An image contain informations that can be extracted using image processing. Usually before image processing, we try to enhance the input through morphological operations. Morphology refers to shape and structure manipulation, thinning, expanding, closing of holes and the like. Because of its versatility,morphological operations find many applications in area measurement, counting, and tracking to name a few [1]. Morphological operations make use of set theory. A brief rundown of set theory is available in source[2].
In this activity, we're going to demonstrate two basic morphological operations, dilation and erosion. We proceed by defining dilation and erosion using set theory and provide examples using different images. To futher understand dilation and erosion better, the reader is recommended to predict the outcome of dilation and erosion on a piece of paper before programming it on a computer.
DILATION
From our activity manual, "dilation of A by B denoted by A dilation B is defined as".
It is important to note that dilation of A by B is the set of all Z's such that B translated by Z union A is not an empty set. B here is called the structuring element. The figure above demonstrates this effect of dilation. In general, we can say that dilation expands the image by the shape of B.
In this activity we use images of square (50×50) , a triangle (base = 50 , height= 30), a circle radius 25), a hollow square (60×60, edges are 4 pixels thick), and a plus sign (8 pixels thick and 50 pixels long for each line). The structuring elements used are 4 x 4 ones, 2 x 4 ones, 4 x 2 ones and a cross. Below are the result of my predictions and the corresponding dilated images.
- my predictions were mostly correct, except for the dilation of a cross using a cross as structuring element. I failed to account for the corners of the cross.
- Results below can be summarize in general as follows:
- 4x4 ones just increase the size uniformly adding 3 pixels
- 2x4 makes the image wider (horizontally) by about 3 pixels
- 4x2 makes the image longer (vertically) by about 3 pixels
- cross adds 2 pixels on all sides except on corners
- Or as a rule of thumb, dilation expands the object similar to the shape of the structuring element (see definition above).
From our activity manual, "The erosion of A by B is the set of all z's such that B translated by z is contained in A."
Summarize below are my predictions and the result of my simulation.
- I failed to predict erosion of the hollow figure using a cross (i.e., presence of 4 dots) and the erosion of the cross using a cross as structuring elements.
- similar to the dilation, the effect of erosion can be thought of as eroding the shape of the element by the structuring element.
I want to acknowledge master, jaya, thirdy for the laughs while programming the code and predicting the results of the erosion and dilation. Miguel for the gimp and the incident about his computer :-p.
References
[1] AP 186 Activity 8 manual
[2] http://en.wikipedia.org/wiki/Set_(mathematics)