Image moment

From formulasearchengine
Jump to navigation Jump to search

In image processing, computer vision and related fields, an image moment is a certain particular weighted average (moment) of the image pixels' intensities, or a function of such moments, usually chosen to have some attractive property or interpretation.

Image moments are useful to describe objects after segmentation. Simple properties of the image which are found via image moments include area (or total intensity), its centroid, and information about its orientation.

Raw moments

For a 2D continuous function f(x,y) the moment (sometimes called "raw moment") of order (p + q) is defined as

for p,q = 0,1,2,... Adapting this to scalar (greyscale) image with pixel intensities I(x,y), raw image moments Mij are calculated by

In some cases, this may be calculated by considering the image as a probability density function, i.e., by dividing the above by

A uniqueness theorem (Hu [1962]) states that if f(x,y) is piecewise continuous and has nonzero values only in a finite part of the xy plane, moments of all orders exist, and the moment sequence (Mpq) is uniquely determined by f(x,y). Conversely, (Mpq) uniquely determines f(x,y). In practice, the image is summarized with functions of a few lower order moments.


Simple image properties derived via raw moments include:

Central moments

Central moments are defined as

where and are the components of the centroid.

If ƒ(xy) is a digital image, then the previous equation becomes

The central moments of order up to 3 are:

It can be shown that:

Central moments are translational invariant.


Information about image orientation can be derived by first using the second order central moments to construct a covariance matrix.

The covariance matrix of the image is now


The eigenvectors of this matrix correspond to the major and minor axes of the image intensity, so the orientation can thus be extracted from the angle of the eigenvector associated with the largest eigenvalue. It can be shown that this angle Θ is given by the following formula:

The above formula holds as long as:

The eigenvalues of the covariance matrix can easily be shown to be

and are proportional to the squared length of the eigenvector axes. The relative difference in magnitude of the eigenvalues are thus an indication of the eccentricity of the image, or how elongated it is. The eccentricity is

Scale invariant moments

Moments ηi j where i + j ≥ 2 can be constructed to be invariant to both translation and changes in scale by dividing the corresponding central moment by the properly scaled (00)th moment, using the following formula.

Rotation invariant moments

It is possible to calculate moments which are invariant under translation, changes in scale, and also rotation. Most frequently used are the Hu set of invariant moments:[1][2]

The first one, I1, is analogous to the moment of inertia around the image's centroid, where the pixels' intensities are analogous to physical density. The last one, I7, is skew invariant, which enables it to distinguish mirror images of otherwise identical images.

A general theory on deriving complete and independent sets of rotation invariant moments was proposed by J. Flusser[3] and T. Suk.[4] They showed that the traditional Hu's invariant set is not independent nor complete. I3 is not very useful as it is dependent on the others. In the original Hu's set there is a missing third order independent moment invariant:

External links


  1. M. K. Hu, "Visual Pattern Recognition by Moment Invariants", IRE Trans. Info. Theory, vol. IT-8, pp.179–187, 1962
  2. Hu Moments' OpenCV method
  3. J. Flusser: "On the Independence of Rotation Moment Invariants", Pattern Recognition, vol. 33, pp. 1405–1410, 2000.
  4. J. Flusser and T. Suk, "Rotation Moment Invariants for Recognition of Symmetric Objects", IEEE Trans. Image Proc., vol. 15, pp. 3784–3790, 2006.