Tuesday, July 15, 2008

Activity 8: Morphological Operations

**I tried to take a picture of my "prediction" paper but with a 2 megapixel phone camera,it's hard to take a decent photograph of anything written, nevermind the total number of pictures that would entail me uploading.

Dilation is defined as a morphological operation where the dilation of A by B denoted by A dilation B is defined as:This involves all z's which are translations of a reflected B that when intersected with A is not the empty set. B is known as a structuring element. The effect of a dilation is to expand or elongate A in the shape of B.

Alternately, Erosion is defined as a morphological operation defined as:The erosion of A by B is the set of all points z such that B translated by z is contained in A. The effect of erosion is to reduce the image by the shape of B.

The activity is to erode and dilate a series of images with a 4x4 square, a 2x4 rectangle, a 4x2 rectangle, and a plus sign with legs 50 pixels long, 1 pixel thick.
using the following scilab code:
im=imread('act8shape.png');
se=ones(4,4);
//replace with (2,4) and (4,2) in turn for the rectangles

//se=[0 0 1 0 0; 0 0 1 0 0; 1 1 1 1 1; 0 0 1 0 0; 0 0 1 0 0];

dil=dilate(im, se, [1,1]);

imshow(dil,2);

ero=erode(im,se,[1,1]);

imshow(ero,2);

**RESULTS:
1)50x50 square
after dilation:after erosion:
2)triangle with 50 base, 30 heightafter dilation:after erosion:
3)circle with radius 25after dilation:after erosion:
4)60x60 hollow square with border width 4after dilation:after erosion:
5)cross with leg length 50, line width 8after dilation:after erosion:
**i give myself a grade of 10 for this activity, because the scilab results closely matched my predictions.
**thank you to ed for debating with me.

No comments: