[mmseshow] [Up] [mmsetrans] | Structuring Elements |
Implemented in Python.
B | Structuring Element Default:
|
N | Double Non-negative integer.
Default:
|
mmsesum creates the structuring element
NB
from N - 1 iterative Minkowski additions with the structuring element
B
.
>>> b = mmimg2se(mmbinary([[1, 1, 1], [1, 1, 1], [0, 1, 0]]))
>>> mmseshow(b)
array([[1, 1, 1], [1, 1, 1], [0, 1, 0]],'1')
>>> b3 = mmsesum(b,3)
>>> mmseshow(b3)
array([[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0]],'1')
>>> b = mmsedisk(1,'2D','CITY-BLOCK','NON-FLAT');
>>> mmseshow(b)
array([[-2147483647, 0, -2147483647], [ 0, 1, 0], [-2147483647, 0, -2147483647]],'i')
>>> mmseshow(mmsesum(b,2))
array([[-2147483647, -2147483647, 0, -2147483647, -2147483647], [-2147483647, 0, 1, 0, -2147483647], [ 0, 1, 2, 1, 0], [-2147483647, 0, 1, 0, -2147483647], [-2147483647, -2147483647, 0, -2147483647, -2147483647]],'i')
def mmsesum(B=None, N=1): if B is None: B = mmsecross() if N==0: if mmisbinary(B): return mmbinary([1]) else: return int32([0]) # identity NB = B for i in range(N-1): NB = mmsedil(NB,B) return NB
[mmseshow] [Up] [mmsetrans] | ![]() |
Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center. |