[mmseshow] [Up] [mmsetrans] Structuring Elements

mmsesum
N-1 iterative Minkowski additions

Synopsis

NB = mmsesum( B = None, N = 1 )

Implemented in Python.

Input

B Structuring Element

Default: None (3x3 elementary cross)

N Double Non-negative integer.

Default: 1

Description

mmsesum creates the structuring element NB from N - 1 iterative Minkowski additions with the structuring element B.

Examples

>>> 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')

Equation

Source Code

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
    

See also

mmdil Dilate an image by a structuring element.
mmseshow Display a structuring element as an image.
mmopen Morphological opening.
mmclose Morphological closing.
mmero Erode an image by a structuring element.
mmseunion Union of structuring elements
[mmseshow] [Up] [mmsetrans] Python