[Top] [Up] [Prev] [Next] [Up] [Basic Concepts] [Demonstrations] [Functions] SDC Morphology Toolbox V1.1 15Jan02

mmlabelflat - Label the flat zones of gray-scale images.


Synopsis
y = mmlabelflat( f, Bc, lambda )
Input
f: Gray-scale (uint8 or uint16) or binary image (logical uint8).
Bc: Structuring element. ( connectivity). Default: Elementary cross (mmsecross).
lambda: Connectivity given by |f(q)-f(p)|<=lambda. Default: 0.
Output
y: Gray-scale (uint8 or uint16) or binary image (logical uint8). (uint16).
Description
mmlabelflat creates the image y by labeling the flat zones of f, according to the connectivity defined by the structuring element Bc. A flat zone is a connected region of the image domain in which all the pixels have the same gray-level (lambda=0). When lambda is different than zero, a quasi-flat zone is detected where two neighboring pixels belong to the same region if their difference gray-levels is smaller or equal lambda. The minimum label of the output image is 1 and the maximum is the number of flat-zones in the image.
Examples

Numerical example

f=uint8([5 5 8 3 0; 5 8 8 0 2])

f =
     5     5     8     3     0
     5     8     8     0     2
g=mmlabelflat(f)

g =
     1     1     2     3     5
     1     2     2     4     6
g1=mmlabelflat(f,mmsecross,2)

g1 =
     1     1     2     3     4
     1     2     2     4     4

Gray-scale image example

A quantized distance transform image is built to be used to compute its flat zones. Note that the background and the hole in the bottom right area are also labeled. The number of the flat zones can be determined by the maximum label value.

f=imread('blob.tif');
d=mmdist(f,mmsebox,'euclidean');
g=uint8(rdivide(double(d),8));
mmshow(g);
fz=mmlabelflat(g,mmsebox);
mmlblshow(fz);
mmstats(fz,'max')

ans =
    13
image
(g)
image
(fz)

Quasi-flat zones

In this case two pixels belong to the same quasi-flat zones if they are 8-neighbors (mmsebox) and if their gray-values difference is smaller or equal 3.

f=imread('pcb_gray.tif');
g=mmlabelflat(f,mmsebox,3);
mmshow(f);
mmlblshow(g);
image
(f)
image
(g)
Equation

equation

See Also
mmblob - Blob measurements from a labeled image.
mmgrain - Gray-scale statistics for each labeled region.
mmlabel - Label a binary image.
mmsebox - Create a box structuring element.
mmsecross - Cross structuring element.

[Top] [Up] [Prev] [Next] [Up] [Basic Concepts] [Demonstrations] [Functions] Valid XHTML 1.0!
Copyright (c) 1998-2002 by SDC Information Systems