{ } Raw JSON

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

function

skimage.measure._moments:moments_central

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

Signature

def   moments_central ( image center = None order = 3 * spacing = None ** kwargs )

Summary

Calculate all central image moments up to a certain order.

Extended Summary

The center coordinates (cr, cc) can be calculated from the raw moments as: {M[1, 0] / M[0, 0], M[0, 1] / M[0, 0]}.

Note that central moments are translation invariant but not scale and rotation invariant.

Parameters

image : (N[, ...]) double or uint8 array

Rasterized shape as image.

center : tuple of float, optional

Coordinates of the image centroid. This will be computed if it is not provided.

order : int, optional

The maximum order of moments computed.

spacing : tuple of float, shape (ndim,)

The pixel spacing along each axis of the image.

Returns

mu : (``order + 1``, ``order + 1``) array

Central image moments.

Examples

image = np.zeros((20, 20), dtype=np.float64)
image[13:17, 13:17] = 1
M = moments(image)
centroid = (M[1, 0] / M[0, 0], M[0, 1] / M[0, 0])
moments_central(image, centroid)

Aliases

  • skimage.measure.moments_central