[mmvdome] [Up] [mmpad4n] Python functions

mmadd4dil
Addition for dilation

Synopsis

a = mmadd4dil( f, c )

Implemented in Python.

Input

f Image Gray-scale (uint8 or uint16) or binary image.

Image

c Image Gray-scale (uint8 or uint16) or binary image.

Constant

Output

a Image

f + c

Source Code

def mmadd4dil(f, c):
    from Numeric import asarray, minimum, maximum
    if c:            
       y = asarray(f,'d') + c
       k1,k2 = mmlimits(f)
       y = ((f==k1) * k1) + ((f!=k1) * y)
       y = maximum(minimum(y,k2),k1)
       a = y.astype(f.typecode())
    else:
       a = f
    return a
    
[mmvdome] [Up] [mmpad4n] Python