

//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


Dilation


Dilation


Dilation


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:
Post a Comment