| [Top] [Up] [Prev] [Next] | [Up] [Basic Concepts] [Demonstrations] [Functions] | SDC Morphology Toolbox V1.1 15Jan02 |
Y = mmcwatershed( f, g, Bc, LINEREG ) 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".Y: Gray-scale (uint8 or uint16) or binary image (logical uint8). 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.
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);
|




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