Wednesday, July 16, 2008

Morphological Operations

For this activity, we analyzed the morphological operations done on binary images, specifically dilation and erosion. The first thing that we did was to predict using hand-drawn images the effects of different structuring elements on the binary images. The structuring elements used and the diolation/erosion predictions can be seen in the drawings below.
To verify if these predictions were correct, these morphological operations were also done in scilab.
//Scilab code
image = imread("50x50square.bmp");
se1 = imread("se1.bmp");
se2 = imread("se2.bmp");
se3 = imread("se3.bmp");
se4 = imread("se4.bmp");

d1 = dilate(image, se1, [1,1]);
d2 = dilate(image, se2, [1,1]);
d3 = dilate(image, se3, [1,1]);
d4 = dilate(image, se4, [3,3]);

//For erosion, just uncomment the following lines
//d1 = erode(image, se1, [1,1]);
//d2 = erode(image, se2, [1,1]);
//d3 = erode(image, se3, [1,1]);
//d4 = erode(image, se4, [3,3]);

subplot(332);
imshow(image, []);

subplot(334);
imshow(d1, []);

subplot(336);
imshow(d2, []);

subplot(337);
imshow(d3, []);

subplot(339);
imshow(d4, []);
//end of code

For the following images, the uppermost image is the original image. The upper left image is the image operated using B1(see drawing), upper right is operated using B2, lower left is operated using B3, and lower is operated using B4.
Square
Dilation

Erosion

Triangle
Dilation
Erosion
Circle
Dilation
Erosion
Hollow Square
Dilation
Erosion
Cross
Dilation
Erosion
Looking at the images produced by scilab, it looks like my predictions were correct.

For this activity, I give myself a grade of 10 because I did the predictions first before making the scilab code and my predictions were quite accurate. Also, I would like to thank Elizabeth Prieto for clarifying some concepts.

No comments: