[mmskelm] [Up] [mmendpoints] | Residues |
Implemented in Python.
f | Image Gray-scale (uint8 or uint16) or binary image. |
B | Structuring Element Default:
|
y | Image Binary image. |
mmskelmrec reconstructs the valued morphological skeleton to recover the original image.
>>> from Numeric import ones
>>> a=mmneg(mmframe(mmbinary(ones((7,9)))))
>>> print a
[[0 0 0 0 0 0 0 0 0] [0 1 1 1 1 1 1 1 0] [0 1 1 1 1 1 1 1 0] [0 1 1 1 1 1 1 1 0] [0 1 1 1 1 1 1 1 0] [0 1 1 1 1 1 1 1 0] [0 0 0 0 0 0 0 0 0]]
>>> b=mmskelm(a,mmsecross(),'value')
>>> print b
[[0 0 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 1 0] [0 0 2 0 0 0 2 0 0] [0 0 0 3 3 3 0 0 0] [0 0 2 0 0 0 2 0 0] [0 1 0 0 0 0 0 1 0] [0 0 0 0 0 0 0 0 0]]
>>> c=mmskelmrec(b,mmsecross())
>>> print c
[[0 0 0 0 0 0 0 0 0] [0 1 1 1 1 1 1 1 0] [0 1 1 1 1 1 1 1 0] [0 1 1 1 1 1 1 1 0] [0 1 1 1 1 1 1 1 0] [0 1 1 1 1 1 1 1 0] [0 0 0 0 0 0 0 0 0]]
def mmskelmrec(f, B=None): from Numeric import ravel if B is None: B = mmsecross() y = mmbinary(mmintersec(f, 0)) for r in range(max(ravel(f)),1,-1): y = mmdil(mmunion(y,mmbinary(f,r)), B) y = mmunion(y, mmbinary(f,1)) return y
[mmskelm] [Up] [mmendpoints] | ![]() |
Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center. |