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

mmcwatershed - Detection of watershed from markers.


Synopsis
Y = mmcwatershed( f, g, Bc, LINEREG )
Input
f: Gray-scale (uint8 or uint16) image.
g: Gray-scale (uint8 or uint16) or binary image (logical uint8). marker image: binary or labeled.
Bc: Structuring element. (watershed connectivity) Default: Elementary cross (mmsecross).
LINEREG: String. 'LINES' or ' REGIONS'. Default: "LINES".
Output
Y: Gray-scale (uint8 or uint16) or binary image (logical uint8).
Description
mmcwatershed creates the image y by detecting the domain of the catchment basins of f indicated by the marker image g, according to the connectivity defined by Bc. According to the flag LINEREG y will be a labeled image of the catchment basins domain or just a binary image that presents the watershed lines. To know more about watershed and watershed from markers, see [BM93] . The implementation of this function is based on [LF00] . WARNING: There is a common mistake related to the marker image g. If this image contains only zeros and ones, but it is not a binary image, the result will be an image with all ones. If the marker image is binary, you have to set this explicitly using the logical function.
Examples
a = uint8([...
    10   10   10   10   10   10   10;...
    10    9    6   18    6    5   10;...
    10    9    6   18    6    8   10;...
    10    9    9   15    9    9   10;...
    10    9    9   15   12   10   10;...
    10   10   10   10   10   10   10]);
b = mmcmp(a,'==',uint8(6))

b =
     0     0     0     0     0     0     0
     0     0     1     0     1     0     0
     0     0     1     0     1     0     0
     0     0     0     0     0     0     0
     0     0     0     0     0     0     0
     0     0     0     0     0     0     0
mmcwatershed(a,b)

ans =
     0     0     0     1     0     0     0
     0     0     0     1     0     0     0
     0     0     0     1     0     0     0
     0     0     0     1     0     0     0
     0     0     0     1     0     0     0
     0     0     0     0     1     0     0
mmcwatershed(a,b,mmsecross,'REGIONS')

ans =
     1     1     1     1     2     2     2
     1     1     1     1     2     2     2
     1     1     1     1     2     2     2
     1     1     1     1     2     2     2
     1     1     1     1     2     2     2
     1     1     1     1     2     2     2
f=mmreadgray('astablet.tif');
grad=mmgradm(f);
mark=mmregmin(mmhbasin(grad,17));
w=mmcwatershed(grad,mark);
mmshow(grad);
mmshow(mark);
mmshow(w);
image
(grad)
image
(mark)
image
(w)
Equation

Equation (watershed regions):

equation

Minimum length of a point to a set:

equation

Length of a point to a set:

equation

Where:

equation

is the path between the point x and subset X under connectivity Bc
See Also
mmdcalc - Extract the keys of a calculator.
mmfreedom - Control automatic data type conversion.
mmsebox - Create a box structuring element.
mmsecross - Cross structuring element.
mmswatershed - Detection of similarity-based watershed from markers.
mmwatershed - Watershed detection.

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