skimage2.morphology.ellipse#

skimage2.morphology.ellipse(width, height, dtype=<class 'numpy.uint8'>, *, decomposition=None)[source]#

Generates a flat, ellipse-shaped footprint.

Every pixel along the perimeter of ellipse satisfies the equation (x/width+1)**2 + (y/height+1)**2 = 1.

Parameters:
widthint

The width of the ellipse-shaped footprint.

heightint

The height of the ellipse-shaped footprint.

Returns:
footprintndarray

The footprint where elements of the neighborhood are 1 and 0 otherwise. The footprint will have shape (2 * height + 1, 2 * width + 1).

Other Parameters:
dtypedtype-like, optional

The data type of the footprint.

decomposition{None, ‘crosses’}, 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.

The ellipse produced by the decomposition='crosses' is often but not always identical to that with decomposition=None. The method is based on an adaption of algorithm 1 given in [1].

References

[1]

Li, D. and Ritter, G.X. Decomposition of Separable and Symmetric Convex Templates. Proc. SPIE 1350, Image Algebra and Morphological Image Processing, (1 November 1990). DOI:10.1117/12.23608

Examples

>>> from _skimage2.morphology import footprints
>>> footprints.ellipse(5, 3)
array([[0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
       [0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0]], dtype=uint8)