[Top] [Up] [Prev] [Next] [Up] [Tutorial] mmtutor V1.0 30abr2001

mm027ero - Erosion


Synopsis
mm027ero
Description

Geometric Interpretation of Erosion

There are two main geometrical interpretation of the erosion: the duality with dilation, and the robot path.

Erosion as the Dual of Dilation

The duality property of the erosion is given by the equation below.

equation

The erosion can be modeled by the dilation of the background (black pixels).

A=imread('blob.tif');
mmshow(A);
B=mmero(A,mmsedisk(10));
mmshow(B);
image
(A)
image
(B)

Below, the duality between the dilation and erosion is illustrated. As the SE used is simmetric, there is no need to reflect it.

A=imread('blob.tif');
C=mmneg(A);
mmshow(C);
D=mmdil(C,mmsedisk(10));
mmshow(D);
E=mmneg(D);
mmshow(E);
mmis(B,'==',E)

ans =
     1
image
(C)
image
(D)
image
(E)

Robot path interpretation

The equation for the erosion for the robot path geometric interpretation is shown below. The erosion are all the points that the translation of the SE by it, fits inside the image. One can think as the SE as a robot shape and the image as the room where the robot can move. As the robot moves by translation only (no rotations), there is a pencil at the robot origin that marks the floor. The result of the erosion is the region that the robot marks the floor, as the robot translated over the whole (room) image.

equation

In the example below, in the final image, the room (original image) is in white, the robot contours, placed at selected points in the room, chosen randomly from the border of the eroded image and the eroded image itself, are overlayed in green, the centers of the translated robot are marked in blue. In red is the eroded image.

A=imread('blob.tif');
mmshow(A);
Bi=imread('blob1.tif');
B=mmimg2se(Bi);
C=mmero(A,B);
mmshow(mmseshow(B));
mmshow(C);
Ba=mmintersec(mmgradm(C),uint8(rand(size(C))>0.99));
Bb=mmintersec(C,uint8(rand(size(C))>0.999));
P = mmunion(Ba,Bb);
Bt = mmimg2se(mmgradm(Bi));
Q = mmdil(P,Bt);
mmshow(A,C,Q,mmdil(P)); 
image
(A)
image
(mmseshow(B))
image
(C)
image
(A,C,Q,mmdil(P))

Erosion and Distance Transform

The Distance Transform (DT) of a binary image is a gray-scale image where the pixel values gives the distance to the background. The DT can also be seen as an Erosion Transform where each erosion by a disk of radius r is stacked to form a gray-scale image.

equation

equation

In the example below, A is the original binary image, d is its Distance Transform and C is an erosion by a cross SE of radius 10. You can notice that C, obtained by thresholding d with value above 10, is equal to the erosion.

A=imread('blob.tif');
mmshow(A);
d=mmdist(A);
mmshow(d);
mmdtshow(d);
C=mmero(A,mmsecross(10));
mmshow(C);
D=mmcmp(d,'>', uint16(10));
mmis(D,'==',C)

ans =
     1
image
(A)
image
(d)
image
(d)
image
(C)

Exercises


[Top] [Up] [Prev] [Next] [Up] [Tutorial] Valid XHTML 1.0!
Copyright (c) 1998-20001 by SDC Information SystemsCopyright (c) 1998-20001 by SDC Information Systems