{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / morphology / footprints / octagon

function

skimage.morphology.footprints:octagon

source: /dev/scikit-image/src/skimage/morphology/footprints.py :893

Signature

def   octagon ( m n dtype = <class 'numpy.uint8'> * decomposition = None )

Summary

Generates an octagon shaped footprint.

Extended Summary

For a given size of (m) horizontal and vertical sides and a given (n) height or width of slanted sides octagon is generated. The slanted sides are 45 or 135 degrees to the horizontal axis and hence the widths and heights are equal. The overall size of the footprint along a single axis will be m + 2 * n.

Parameters

m : int

The size of the horizontal and vertical sides.

n : int

The height or width of the slanted sides.

Returns

footprint : ndarray or tuple

The footprint where elements of the neighborhood are 1 and 0 otherwise. When decomposition is None, this is just a numpy.ndarray. Otherwise, this will be a tuple whose length is equal to the number of unique structuring elements to apply (see Notes for more detail)

Other Parameters

dtype : dtype-like, optional

The data type of the footprint.

decomposition : {None, 'sequence'}, optional

If None, a single array is returned. For 'sequence', a tuple of smaller footprints is returned. Applying this series of smaller footprints will given an identical result to a single, larger footprint, but with better computational performance. See Notes for more details.

Notes

When decomposition is not None, each element of the footprint tuple is a 2-tuple of the form (ndarray, num_iter) that specifies a footprint array and the number of iterations it is to be applied.

For either binary or grayscale morphology, using decomposition='sequence' was observed to have a performance benefit, with the magnitude of the benefit increasing with increasing footprint size.

Aliases

  • skimage.morphology.octagon