{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / measure / _moments / centroid

function

skimage.measure._moments:centroid

source: /dev/scikit-image/src/skimage/measure/_moments.py :385

Signature

def   centroid ( image * spacing = None )

Summary

Return the (weighted) centroid of an image.

Parameters

image : array

The input image.

spacing : tuple of float, shape (ndim,)

The pixel spacing along each axis of the image.

Returns

center : tuple of float, length ``image.ndim``

The centroid of the (nonzero) pixels in image.

Examples

image = np.zeros((20, 20), dtype=np.float64)
image[13:17, 13:17] = 0.5
image[10:12, 10:12] = 1
centroid(image)

Aliases

  • skimage.measure.centroid

Referenced by