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

mm032gray - Gray Scale Dilation and Erosion.


Synopsis
mm032gray
Description

Visualization of the 2D gray scale dilation

A simple synthetic gray scale image is dilated by a flat SE 7x7 box to illustrate the operator effect on its surface. Three visualizations are used: gray scale mapping, top view and surface view.

f=imread('ggray.tif');
g=mmdil(f,mmsebox(3));
mmshow(f);
mmshow(g);
image
(f)
image
(g)
mmshow(mmsurf(f));
mmshow(mmsurf(g));
image
(mmsurf(f))
image
(mmsurf(g))
mmsurfshow(f);
mmsurfshow(g);
image
(f)
image
(g)

Here a real image is dilated by a disk of radius 3 (7x7 support). Both original and dilated images are visualized as gray scale and as top view of their surface.

f=imread('n2538.tif');
mmshow(f);
B=mmsedisk(3);
g=mmdil(f,B);
mmshow(g);
image
(f)
image
(g)
mmshow(mmsurf(f));
mmshow(mmsurf(g));
image
(mmsurf(f))
image
(mmsurf(g))

Gray Scale Erosion: Flat Structuring Element

The erosion is the dual of the dilation. Its formulation for a flat SE is the following.

equation

Below, a signal is eroded by a non-symmetrical SE. The original signal is displayed in red and the eroded in blue.

f=imread('heart_uint8.tif');
x=1:size(f,2);
B=mmimg2se(logical(uint8([zeros(1,18) ones(1,50)])));
g=plot(x,f,'-r',x,mmero(f,B),'-b');  
image
(g)

Here, a synthetic image is eroded and visualized in the same as done with the dilation illustration. The erosion uses a box 7x7 flat SE.

f=imread('ggray.tif');
g=mmero(f,mmsebox(3));
mmshow(f);
mmshow(g);
image
(f)
image
(g)
mmshow(mmsurf(f));
mmshow(mmsurf(g));
image
(mmsurf(f))
image
(mmsurf(g))
mmsurfshow(f);
mmsurfshow(g);
image
(f)
image
(g)

Here a real image is eroded by a disk of radius 3 (7x7 support). Both original and dilated images are visualized as gray scale and as top view of its surface.

f=imread('n2538.tif');
mmshow(f);
B=mmsedisk(3);
g=mmero(f,B);
mmshow(g);
image
(f)
image
(g)
mmshow(mmsurf(f));
mmshow(mmsurf(g));
image
(mmsurf(f))
image
(mmsurf(g))

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