def octagon(m, n, dtype=np.uint8):
 from . import convex_hull_image
 selem = np.zeros(((m + (2 * n)), (m + (2 * n))))
 selem[(0, n)] = 1
 selem[(n, 0)] = 1
 selem[(0, ((m + n) - 1))] = 1
 selem[(((m + n) - 1), 0)] = 1
 selem[((-1), n)] = 1
 selem[(n, (-1))] = 1
 selem[((-1), ((m + n) - 1))] = 1
 selem[(((m + n) - 1), (-1))] = 1
 selem = convex_hull_image(selem).astype(dtype)
 return selem

def octagon ( m , n , dtype = np . uint8 ) : from . import convex_hull_image selem = np . zeros ( ( ( m + ( 2 * n ) ) , ( m + ( 2 * n ) ) ) ) selem [ ( 0 , n ) ] = 1 selem [ ( n , 0 ) ] = 1 selem [ ( 0 , ( ( m + n ) - 1 ) ) ] = 1 selem [ ( ( ( m + n ) - 1 ) , 0 ) ] = 1 selem [ ( ( - 1 ) , n ) ] = 1 selem [ ( n , ( - 1 ) ) ] = 1 selem [ ( ( - 1 ) , ( ( m + n ) - 1 ) ) ] = 1 selem [ ( ( ( m + n ) - 1 ) , ( - 1 ) ) ] = 1 selem = convex_hull_image ( selem ) . astype ( dtype ) return selem
generates an octagon shaped structuring element .