Image.humoments#

Image.humoments() ndarray[source]#

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:

Important

Uses OpenCV functions cv2.moments and cv2.HuMoments which accept single-channel, CV_8U, CV_16U, CV_16S, CV_32F or CV_64F images.

Seealso:

moments opencv.HuMoments