Answers to questions:
1. XOR corresponds to the complement of the union of A and B
2. NOT(A) and B corresponds to the intersection of the (complement of A) and (B)
Dilation and Erosion
The fihures above are the images to be eroded and dilated with a 4 by 4, 4 by 2, 2 by 4 ones and a cross 5 pixels long and 1 pixel thick.
The results for erosion are the following images corresponding to their original image.
Eroded image of a triangle
Eroded image of a circle
Eroded image of a cross
Eroded image of a circle
Eroded image of a cross
The eroded images not only followed the shape of the patterns but also reduced its size. In my predictions, I only accounted for the decrease in the size.
The results for dilation are the following images corresponding to their original image.
The results for dilation are the following images corresponding to their original image.
Dilated image of a square
Dilated image of a triangle
Dilated image of a circle
Dilated image of a cross
Dilated image of a triangle
Dilated image of a circle
Dilated image of a cross
The dilated image as predicted inreased in size but again, the shape of the pattern follow by the image was not accounted in the predictions.
Rating: i'll give myself 8 points. I did this activity alone and I missed some of the predicted output.
code:
erosion and dilation: note- just change dilate to erode and vice versa
im=imread('C:\Documents and Settings\Instru\Desktop\a8_cross.bmp');
a1=[1 1 1 1; 1 1 1 1; 1 1 1 1; 1 1 1 1];
a2=[1 1 1 1; 1 1 1 1];
a3=[1 1; 1 1; 1 1; 1 1];
a4=[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];
im1=dilate(im,a1);
im2=dilate(im,a2);
im3=dilate(im,a3);
im4=dilate(im,a4);
subplot(221);
imshow(im1,[]);
subplot(222);
imshow(im2,[]);
subplot(223);
imshow(im3,[]);
subplot(224);
imshow(im4,[]);
Rating: i'll give myself 8 points. I did this activity alone and I missed some of the predicted output.
code:
erosion and dilation: note- just change dilate to erode and vice versa
im=imread('C:\Documents and Settings\Instru\Desktop\a8_cross.bmp');
a1=[1 1 1 1; 1 1 1 1; 1 1 1 1; 1 1 1 1];
a2=[1 1 1 1; 1 1 1 1];
a3=[1 1; 1 1; 1 1; 1 1];
a4=[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];
im1=dilate(im,a1);
im2=dilate(im,a2);
im3=dilate(im,a3);
im4=dilate(im,a4);
subplot(221);
imshow(im1,[]);
subplot(222);
imshow(im2,[]);
subplot(223);
imshow(im3,[]);
subplot(224);
imshow(im4,[]);
No comments:
Post a Comment