machinevisiontoolbox.Image.humoments

Image.humoments()

Hu image moment invariants

Returns:

Hu image moments

Return type:

ndarray(7)

Computes the seven Hu image moment invariants of the image.

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Read('shark1.png', dtype='float')
>>> img.humoments()
array([0.2126, 0.0109, 0.0004, 0.0002, 0.    , 0.    , 0.    ])
Note:
  • Image is assumed to be a binary image of a single connected region

  • These invariants are a function of object shape and are invariant to position, orientation and scale.

References:
  • M-K. Hu, Visual pattern recognition by moment invariants. IRE Trans. on Information Theory, IT-8:pp. 179-187, 1962.

  • Robotics, Vision & Control for Python, Section 12.1.3.6, P. Corke, Springer 2023.

Seealso:

moments opencv.HuMoments