[mmregmax] [Up] [mmsuprec] | Connected Operators |
Implemented in Python.
f | Image Gray-scale (uint8 or uint16) image. |
Bc | Structuring Element (connectivity). Default:
|
option | String Choose one of: BINARY: output a binary image; VALUE: output a grayscale image with points at the regional minimum with the pixel values of the input image; DYNAMICS: output a grayscale image with points at the regional minimum with its dynamics; AREA-DYN: int32 image with the area-dynamics; VOLUME-DYN: int32 image with the volume-dynamics. Default:
|
y | Image Gray-scale (uint8 or uint16) or binary image. |
mmregmin creates a binary image
f
by computing the regional minima of
f
, according to the connectivity defined by the structuring element
Bc
. A regional minimum is a flat zone not surrounded by flat zones of lower gray values. A flat zone is a maximal connected component of a gray-scale image with same pixel values. There are three output options: binary image; valued image; and generalized dynamics. The dynamics of a regional minima is the minimum height a pixel has to climb in a walk to reach another regional minima with a higher dynamics. The area-dyn is the minimum area a catchment basin has to raise to reach another regional minima with higher area-dynamics. The volume-dyn is the minimum volume a catchment basin has to raise to reach another regional minima with a higher volume dynamics.
The dynamics concept was first introduced in Grimaud:92 and it is the basic notion for the hierarchical or multiscale watershed transform.
>>> a = uint8([ [10, 10, 10, 10, 10, 10, 10], [10, 9, 6, 18, 6, 5, 10], [10, 9, 6, 18, 6, 5, 10], [10, 9, 9, 15, 4, 9, 10], [10, 9, 9, 15, 12, 10, 10], [10, 10, 10, 10, 10, 10, 10]])
>>> print mmregmin(a)
[[0 0 0 0 0 0 0] [0 0 1 0 0 1 0] [0 0 1 0 0 1 0] [0 0 0 0 1 0 0] [0 0 0 0 0 0 0] [0 0 0 0 0 0 0]]
>>> print mmregmin(a,mmsecross(),'value')
[[0 0 0 0 0 0 0] [0 0 6 0 0 5 0] [0 0 6 0 0 5 0] [0 0 0 0 4 0 0] [0 0 0 0 0 0 0] [0 0 0 0 0 0 0]]
>>> print mmregmin(a,mmsecross(),'dynamics')
[[ 0 0 0 0 0 0 0] [ 0 0 4 0 0 1 0] [ 0 0 4 0 0 1 0] [ 0 0 0 0 14 0 0] [ 0 0 0 0 0 0 0] [ 0 0 0 0 0 0 0]]
>>> f1=mmreadgray('bloodcells.tif')
>>> m1=mmregmin(f1,mmsebox())
>>> mmshow(f1,m1)
>>> f2=mmhmin(f1,70)
>>> mmshow(f2)
>>> m2=mmregmin(f2,mmsebox())
>>> mmshow(f2,m2)
![]() |
![]() |
|
f1,m1 | f2 |
![]() |
|
f2,m2 |
def mmregmin(f, Bc=None, option="binary"): if Bc is None: Bc = mmsecross() fplus = mmaddm(f,1) g = mmsubm(mmsuprec(fplus,f,Bc),f) y = mmunion(mmthreshad(g,1),mmthreshad(f,0,0)) return y
[mmregmax] [Up] [mmsuprec] | ![]() |
Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center. |