bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / morphology / footprints / footprint_rectangle
function
skimage.morphology.footprints:footprint_rectangle
source: /dev/scikit-image/src/skimage/morphology/footprints.py :81
Signature
def footprint_rectangle ( shape , * , dtype = <class 'numpy.uint8'> , decomposition = None ) Summary
Generate a rectangular or hyper-rectangular footprint.
Extended Summary
Generates, depending on the length and dimensions requested with shape, a square, rectangle, cube, cuboid, or even higher-dimensional versions of these shapes.
Parameters
shape: tuple[int, ...]The length of the footprint in each dimension. The length of the sequence determines the number of dimensions of the footprint.
dtype: dtype-like, optionalThe data type of the footprint.
decomposition: {None, 'separable', 'sequence'}, optionalIf None, a single array is returned. For 'sequence', a tuple of smaller footprints is returned. Applying this series of smaller footprints will give an identical result to a single, larger footprint, but often with better computational performance. See Notes for more details. With 'separable', this function uses separable 1D footprints for each axis. Whether 'sequence' or 'separable' is computationally faster may be architecture-dependent.
Returns
footprint: array or tuple[tuple[ndarray, int], ...]A footprint consisting only of ones, i.e. every pixel belongs to the neighborhood. When
decompositionis None, this is just an array. Otherwise, this will be a tuple whose length is equal to the number of unique structuring elements to apply (see Examples for more detail).
Examples
import skimage as ski ski.morphology.footprint_rectangle((3, 5))✓
ski.morphology.footprint_rectangle((9, 9), decomposition="sequence")
✗ski.morphology.footprint_rectangle((3, 5), decomposition="separable")
✗ski.morphology.footprint_rectangle((3,) * 5).shape
✓Aliases
-
skimage.morphology.footprint_rectangle