Function iapad4n

namespace:morph
page:iapad4n

Synopse

iapad4n

  • y = iapad4n(f, Bc, value, scale=1)
    • y: None
    • f: Image
    • Bc: Structuring Element ( connectivity).
    • value: int
    • scale: int
01. from numpy import *
02. 
03. def iapad4n(f, Bc, value, scale=1):
04.     from iaseshow import iaseshow
05. 
06.     if type(Bc) is not array:
07.       Bc = iaseshow(Bc)
08.     Bh, Bw = Bc.shape
09.     assert Bh%2 and Bw%2, 'structuring element must be odd sized'
10.     ch, cw = scale * Bh/2, scale * Bw/2
11.     g = value * ones( f.shape + scale * (array(Bc.shape) - 1))
12.     g[ ch: -ch, cw: -cw] = f
13.     y = g.astype( f.dtype.char)
14. 
15. 
16.     return y