Thursday, August 6, 2009

ACTIVITY 8 - Morphological Operations

The goal of this activity is to verify the effect of morphological operations, dilate and erode in different shapes using varying structuring element.

Binary image of square (50 x 50), a triangle (base = 50, height = 30), a circle (r = 25), a hollow square (60 x 60, edges are 4 pixels thick) and a plus sign (8 pixels thick and 50 pixels long for each line) were created in MS Paint.


To be able to used the dilate and erode, structuring elements are needed. The following structuring elements were utilized for each images created.
1. 4 x 4 ones
2. 2 x 4 ones
3. 4 x 2 ones
4. cross, 5 pixels long and one pixel thick

The morphological operations were implemented with the use of the built-in function dilate and erode in Scilab.

A = dilate(image, a);

The dilation of A by B is denoted by
Thus, dilation will result to the expansion or elongation of the image according to the shape of the structuring element.


A1 = erode(image, a);

The erosion of A by B is denoted by

Using erosion will reduce the image according to the shape of the structuring element.

But before running the code, a prediction on what will be the resulting image was done. The following images show the resulting image after the implementation of morphological operations. The resulting images are shown according to the structuring element used (4x4, 2x4, 4x2, cross).
Square (50 x 50)
Dilated
Eroded

Triangle (base = 50, height = 30)
Dilated
Eroded

Circle (r = 25)
Dilated
Eroded

Hollow Square (60 x60, edges are 4 pixels thick)
Dilated
Eroded

Plus Sign (8 pixels thick and 50 pixels long for each line)
Dilated
Eroded

From the images, dilation indeed expands the image while erosion reduces the image depending on the structuring element.
-------------------------------------------------------------------------------------------------
Other morphological operations, thin and skel were explored using Scilab. The following images resulted after the implementation of these operations on the shapes created in the previous part.

A = thin(image1);
A1 = skel(image1);

Thin
Skel

Applying thin function resulted to thinning of the shapes while skel resulted to random patterns along the shape.


I give myself an 8 for this activity. It was Gilbert who taught me how the dilate and erode functions work. I had a hard time predicting on the outcomes of each morphological operation although I made the code with an ease. As I noticed, dilation expanded the image while erosion reduced the image depending on the structuring element being used. The thin and skel are just other morphological operations that can be used for further image processing techniques.

No comments:

Post a Comment