{ } Raw JSON

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

function

skimage.measure._moments:moments_hu

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

Signature

def   moments_hu ( nu )

Summary

Calculate Hu's set of image moments (2D-only).

Extended Summary

Note that this set of moments is proved to be translation, scale and rotation invariant.

Parameters

nu : (M, M) array

Normalized central image moments, where M must be >= 4.

Returns

nu : (7,) array

Hu's set of image moments.

Examples

image = np.zeros((20, 20), dtype=np.float64)
image[13:17, 13:17] = 0.5
image[10:12, 10:12] = 1
mu = moments_central(image)
nu = moments_normalized(mu)
np.round(moments_hu(nu), 4)  # doctest: +FLOAT_CMP

Aliases

  • skimage.measure.moments_hu