skimage2.measure.moments_hu#

skimage2.measure.moments_hu(nu)[source]#

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

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.

References

[1]

M. K. Hu, “Visual Pattern Recognition by Moment Invariants”, IRE Trans. Info. Theory, vol. IT-8, pp. 179-187, 1962

[2]

Wilhelm Burger, Mark Burge. Principles of Digital Image Processing: Core Algorithms. Springer-Verlag, London, 2009.

[3]

B. JÃĪhne. Digital Image Processing. Springer-Verlag, Berlin-Heidelberg, 6. edition, 2005.

[4]

T. H. Reiss. Recognizing Planar Objects Using Invariant Image Features, from Lecture notes in computer science, p. 676. Springer, Berlin, 1993.

Examples

>>> from _skimage2.measure import moments_central, moments_normalized
>>> 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)
array([0.7454, 0.3512, 0.104 , 0.0406, 0.0026, 0.0241, 0.    ])