Activity 8: Morphological Transforms
Dilation and Erosion are morphological transform where we have a binary image (white/1 foreground and black/0 background). Dilation is mathematical defined as
where A is the image and B is called the structuring element where the dilation is based. In lay terms (or in more comprehensible terms), Is the set that involves all z’s which are translations of a reflected B that when intersected with A is not the empty set. This can be illustrated as
On the other hand, erosion is mathematically defined as
or in more comprehensible terms, 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. This can be illustrated as
(based on Dr Soriano’s lecture)
In this activity, we used different images (circle, square, hollow square, triangle and cross) and varying structuring elements shown here:
The results of the morphological transform are shown below. The code is
se1=ones(4,4); //square
se2=ones(2,4); //rectangle
se3=ones(4,2); //rectangle
se4=[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]; //cross
im=imread(‘cross.PNG’);
im=im(:,:,1);
er1=erode(im, se1, [1,1]);
er2=erode(im, se2, [1,1]);
er3=erode(im, se3, [1,1]);
er4=erode(im, se4, [3,3]);
di1=dilate(im, se1, [1,1]);
di2=dilate(im, se2, [1,1]);
di3=dilate(im, se3, [1,1]);
di4=dilate(im, se4, [3,3]);
scf(1);
subplot(2,2,1);
imshow(se1);
subplot(2,2,2);
imshow(se2);
subplot(2,2,3);
imshow(se3);
subplot(2,2,4);
imshow(se4);
scf(2);
subplot(2,2,1);
imshow(er1);
subplot(2,2,2);
imshow(er2);
subplot(2,2,3);
imshow(er3);
subplot(2,2,4);
imshow(er4);
scf(3);
subplot(2,2,1);
imshow(di1);
subplot(2,2,2);
imshow(di2);
subplot(2,2,3);
imshow(di3);
subplot(2,2,4);
imshow(di4);
Circle Dilation
Circle Erosion
Cross
Cross Dilate
Cross Erode
hollow
Hollow Dilate
Hollow Erode
Square
Square Dilate
Square Erode
Triangle
triangle dilate
triangle erode
I will give my self 10 pts here since the actual and predicted are in good correspondence.
Thanks to Julie and JC for the help. 🙂
Leave a comment