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

mm025dilat - Dilation.


Synopsis
mm025dilat
Description

Geometric Interpretation of Dilation

There are three main geometrical interpretations of the dilation: the paint brush or stamp, translating and stamping the whole image, and walking on the contour.

Paint brush or stamp

The translation invariant dilation can be written as the union of translated structuring elements. This is the paint brush or stamping interpretation. The white image pixels coordinates are the center where the structuring element is stamped. So the image gives the information for the pen stroke, and the SE gives the shape of the brush.

equation

A=imread('linha.tif');
mmshow(A);
B=mmsedisk(10);
C=mmdil(A,B);
B=mmseshow(B);
mmshow(B);
mmshow(C); 
image
(A)
image
(B)
image
(C)

Stamping versions of the translated image

The translation invariant dilation is commutative and as such, the same equation used for the paint brush interpretation can be used here, but swapping the image with the SE. In this case the image is the stamp and the points of the SE are the coordinates to translate the image stamp.

equation

In the example below, Ba are the randomly selected points of the SE Bt that is used to translate the contour of the image, which is stored in Q.

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

Walking on the contour

Another equivalent equation of the dilation has the interpretation of touching the SE around the white image pixels and making the SE center as the new image border. In this case, it is necessary to reflect the SE around the origin. The dilated image is formed by all pixels given by the center of the reflected SE such that the intersection of this SE and the image is not empty.

equation

In the example below, Br is the reflected SE. P is built for illustrative purpose to select randomly some points in the contour of the dilated image. In the final image, the dilated image is white, Q is the image where the reflected SE is stamped on the contour of the dilated image, illustrating this geometric interpretation.

A=imread('scissors.tif');
mmshow(A);
B=mmimg2se(imread('blob1.tif'));
C=mmdil(A,B);
Br=mmimg2se(rot90(rot90(imread('blob1.tif'))));
mmshow(mmseshow(B));
mmshow(mmseshow(Br));
mmshow(C);
P=mmintersec(mmgradm(C), uint8(rand(size(C))>0.99));
Q=mmunion(mmgradm(mmdil(P,Br)),mmdil(P));
mmshow(C,Q,mmgradm(A)); 
image
(A)
image
(mmseshow(B))
image
(mmseshow(Br))
image
(C)
image
(C,Q,mmgradm(A))

Example of using dilation to place numbers on image

In this demonstration, an image with blobs is labeled and its label number is drawn at each blob center. To implement this, a SE is created for each number and stamped at the blob center using the dilation.

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