11
$\begingroup$

I'm studying OpenCV and, in computer vision and image processing, people speak of blobs, contours, connected regions, and I sometimes hear the phrase "image moments".

I know of an article on Wikipedia about it, but I think it is too technical. I don't really want to go deep into the math background but I want to know what I'm talking about.

Could someone explain to me what image moments are in plain English?

$\endgroup$

2 Answers 2

8
$\begingroup$

Image moments are the same notion as in Mechanics. The first order moment will give you the center of mass, where the mass of a pixel is its intensity, second order moment will tell you how this mass varies around the center of mass, etc. In the same way as you obtain a frame of inertia for a real world object, you can obtain one from the image moments. That will give you the principal axes of the shape you want to describe.

$\endgroup$
7
  • $\begingroup$ Are you sure the last phrase, "that will give you the principal axes of the SHAPE you want to describe" is correct? I think first, second, etc. moments don't relate to orthogonal axes, or orientation in general, but to the overall statistic characteristic of the image, isn't it? (not really sure, actually) $\endgroup$ Jan 8, 2013 at 1:14
  • $\begingroup$ Yes, I'm pretty sure. In a standard context, you will compute the moments on a binarized image where background = 0 and object = 1. Then, the first order moment of this gives you the center of mass, and the matrix of the 2 second order gives you the 2 principal axis after diagonalization. It's a way to normalize shapes btw. Think of mechanical inertia: it's dirtily related to how an object is balanced and around which point it will rotate. $\endgroup$
    – sansuiso
    Jan 8, 2013 at 20:30
  • $\begingroup$ What confuses me most is this part form a previous answer: "In image processing, if you want to compare images, you might not want the comparison to be sensitive to minor things like rotation, translation, and scale (since the image remains fundamentally the same)." Since principal axes are sensitive to orientation (rotation), then after all the second moment IS or IS NOT sensitive to rotation? $\endgroup$ Jan 8, 2013 at 21:19
  • $\begingroup$ What you do is to express the shape in the frame defined by the principal axes. This performs an implicit rotation, that will in particular make horizontal the first principal axis. So the second moment, expressed in this new frame, becomes invariant to rotation. $\endgroup$
    – sansuiso
    Jan 8, 2013 at 22:30
  • $\begingroup$ sorry but, how many moments can be calculated? $\endgroup$
    – nkint
    Jan 12, 2013 at 16:56
8
$\begingroup$

An image moment is simply a number that characterizes the image, construed as the realization of a spatial random variable. If you've taken any probability class, you should remember the concepts of mean and variance, which are derived from the first and second moments of the random variable (the n'th moment of an r.v. is the expectation of its n'th power). Furthermore, the moments of a random variable collectively prescribe its distribution. In other words, you can reduce a probability distribution to a sequence of numbers, and this is useful when you want to compare distributions numerically.

In image processing, if you want to compare images, you might not want the comparison to be sensitive to minor things like rotation, translation, and scale (since the image remains fundamentally the same). Thus the motivation behind invariant moments you see in the Wikipedia article you cited.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.