[mmcwatershed] [Up] [mmswatershed] | Thinning And Thickening |
Implemented in Python.
f | Image Binary image. |
Bc | Structuring Element Connectivity for the distance measurement. Default:
|
LINEREG | String 'LINES' or 'REGIONS'. Default:
|
METRIC | String 'EUCLIDEAN' if specified. Default:
|
y | Image Gray-scale (uint8 or uint16) or binary image. |
mmskiz creates the image
y
by detecting the lines which are equidistant to two or more connected components of
f
, according to the connectivity defined by
Bc
. Depending on with the flag LINEREG,
y
will be a binary image with the skiz lines or a labeled image representing the zone of influence regions. When the connected objects of
f
are single points, the skiz is the Voronoi diagram.
>>> f=mmreadgray('blob2.tif')
>>> y=mmskiz(f,mmsebox(),'LINES','EUCLIDEAN')
>>> mmshow(f,y)
![]() |
|
f,y |
>>> from Numeric import zeros
>>> f=mmbinary(zeros((100,100)))
>>> f[30,25],f[20,75],f[50,50],f[70,30],f[80,70] = 1,1,1,1,1
>>> y = mmskiz(f,mmsebox(),'LINES','EUCLIDEAN')
>>> mmshow(f,y)
![]() |
|
f,y |
For Euclidean metric, please see
mmdist
.
def mmskiz(f, Bc=None, LINEREG="LINES", METRIC=None): from string import upper if Bc is None: Bc = mmsecross() LINEREG = upper(LINEREG) if METRIC is not None: METRIC = upper(METRIC) d = mmdist( mmneg(f), Bc, METRIC) return mmcwatershed(d,f,Bc,LINEREG) return y
mmdist | Distance transform. |
mmcwatershed | Detection of watershed from markers. |
[mmcwatershed] [Up] [mmswatershed] | ![]() |
Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center. |