[mmskiz] [Up] [mmthick] Thinning And Thickening

mmswatershed
Detection of similarity-based watershed from markers.

Synopsis

y = mmswatershed( f, g, B = None, LINEREG = "LINES" )

Implemented in Python.

Input

f Image Gray-scale (uint8 or uint16) image.
g Image Gray-scale (uint8 or uint16) or binary image.

Marker image. If binary, each connected component is an object marker. If gray, it is assumed it is a labeled image.

B Structuring Element

(watershed connectivity)

Default: None (3x3 elementary cross)

LINEREG String

'LINES' or ' REGIONS'.

Default: "LINES"

Output

y Image Gray-scale (uint8 or uint16) or binary image.

Description

mmswatershed creates the image y by detecting the domain of the catchment basins of f indicated by g, according with the connectivity defined by B. This watershed is a modified version where each basin is defined by a similarity criterion between pixels. The original watershed is normally applied to the gradient of the image. In this case, the gradient is taken internally. 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. The implementation of this function is based on LotuFalc:00.

Examples

Numerical
>>> f = uint8([
    [0,  0,  0,  0,  0,  0,  0],
    [0,  1,  0,  0,  0,  1,  0],
    [0,  1,  0,  0,  0,  1,  0],
    [0,  1,  1,  1,  1,  1,  0],
    [0,  1,  0,  0,  0,  0,  0],
    [0,  0,  0,  0,  0,  0,  0]])

              
>>> m = uint8([
    [0,  0,  0,  0,  0,  0,  0],
    [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,  0,  0,  0],
    [0,  0,  0,  2,  0,  0,  0]])

              
>>> print mmswatershed(f,m,mmsecross(),'REGIONS')
[[2 2 2 2 2 2 2]
 [2 1 2 2 2 1 2]
 [2 1 2 2 2 1 2]
 [2 1 1 1 1 1 2]
 [2 1 2 2 2 2 2]
 [2 2 2 2 2 2 2]]

Source Code

def mmswatershed(f, g, B=None, LINEREG="LINES"):
    if B is None: B = mmsecross()
    print 'Not implemented yet'
    return None
    return y
    

See also

mmcwatershed Detection of watershed from markers.
mmwatershed Watershed detection.
mmfreedom Control automatic data type conversion.
mmsebox Create a box structuring element.
mmsecross Diamond structuring element and elementary 3x3 cross.
[mmskiz] [Up] [mmthick] Python