| [mmadd4dil] [Up] | Python functions |
Implemented in Python.
| f | Image |
| Bc | Structuring Element ( connectivity). |
| value | int. |
| scale | int. Default:
|
| y | The converted image |
def mmpad4n(f, Bc, value, scale=1):
from Numeric import ones, array
if type(Bc) is not array:
Bc = mmseshow(Bc)
Bh, Bw = Bc.shape
assert Bh%2 and Bw%2, 'structuring element must be odd sized'
ch, cw = scale * Bh/2, scale * Bw/2
g = value * ones( f.shape + scale * (array(Bc.shape) - 1))
g[ ch: -ch, cw: -cw] = f
y = g.astype( f.typecode())
return y
| [mmadd4dil] [Up] | |
| Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center. |