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:
M-K. Hu, Visual pattern recognition by moment invariants. IRE Trans. on Information Theory, IT-8:pp. 179-187, 1962.
P. Corke, Robotics, Vision & Control for Python, Springer, 2023, Section 12.1.3.6.
Important
Uses OpenCV functions
cv2.momentsandcv2.HuMomentswhich accept single-channel, CV_8U, CV_16U, CV_16S, CV_32F or CV_64F images.- Seealso: