Contour and area, raw (spatial) and central image moments
Actually, I was surprised how hard was it do deduct a proper definition of contour versus "normal", non-contour moments of an image. After reading a bunch of materials, here come my conclusions.



Firstly, in order to understand moments, and especially the difference and the usage of spatial (what the OP calls "raw"), central, and central normalized moments, I found two very good materials:


(manual) Johannes Kilian: "Simple Image Analysis By Moments"

Excellent manual with simple mathematics. Don't be scared by the integrals - you can read all of them as summations.

Also, it has a small overview on OpenCV functions used to operate with this moments. It's very old material (2001), so the OpenCV manual it is referring to is a bit old, but it still helps.

And than there's the wonderful third chapter, specifying which moment is used to describe which characteristic of a moment.
(image processing blog) Utkarsh: Image Moments

Simple, short and friendly. I found a lot of good material on this blog before.

Disclaimer AI Shack seemed to be offline at some point. Here is the homepage from the AI Shack author, where he talks about this project, so it still seems to be supported. I hope it comes back online soon, but if not maybe it can be tracked through the author's webpage.




Shortly, the spatial moments give information about the object in the image, i.e. related (dependent) on the object position.

The central moments are adjusted for translational invariance, by moving the origin of the "coordinate system" used for calculations to the centroid (center of gravity) of the object in question.

Finally, the central normalized moments are scaled by the area of the object, and are thus scale invariant in addition to translational invariance.



Now for the actual question part: what about contour moments?

The deductions from this part are mostly based on


OpenCV reference manual, v. 2.4.4.0, Chapter 3.5: Structural Analysis and Shape Descriptors
wikipedia page for Green's theorem - following the link from OpenCV manual, the method used when calculating contour moments (I'll explain in a few lines)
Gary Bradski, Adrian Kaehler: "Learning OpenCV: Computer Vision with the OpenCV Library"

(Link is to google books, but the relevant pages are accessible. The section that I linked to, plus the next 2-3 sections are relevant. That's about 3 pages total)


And the most important quotes from those sources:


  The moments of a contour are deﬁned in the same way but computed using the Green’s formula.


(OpenCV reference manual)


  In plane geometry, and in particular, area surveying, Green's theorem can be used to determine the area and centroid of plane figures solely by integrating over the perimeter.


(wiki for Green)


  Moreover, cvContourMoments is now just an alias for cvMoments.


(Bradski Kaehler book)

Based on that, I would deduce that contour moments does not refer to special measures of the object contours, but instead to a particular way to calculate image moments, only using the contour information (instead of pixel information for the whole image).

The difference, in the fundamental case, would be how both are calculated.


My guess would be that the direct implementation would work by pixel-by-pixel summation, directly implementing the formula. The object is expected to be filled.
My guess for the contour moments would be that the image contours are first determined (consult OpenCV manual) and then the Green theorem is applied on the contour data.


That would make the measurements slightly different for real images because the methods would differ in their: sensitivity to: noise, scaling, discretisation (pixel grid instead of continuous image). Also, the speed: calculating using contours is faster than using the direct approach. I would speculate that they would give perfectly equal results for an (idealized) continuous black and white image with no noise.

So, to answer your questions: the moments should be the same (differing because of noise etc). You can use spatial (raw) moments calculated by both methods to determine central moments (that will still describe the same thing).

Further support of this claims is the existence of this article (I only read the abstract, but should be very relevant, and even the abstract is informative) from 1994:


Luren Yang, Fritz Albregtsen: "Fast and Exact Computation of Moments Using Discrete Green's Theorem"




Note about getting the perimeter measure: I think, to get the "perimeter" which is actually just area of the contour, I would calculate the $0^{th}$ moment of the image of the contours of the objects, but treat the contours as a really thin object, instead of as "contours of an object".

All further measurements would of course differ if you used this moment further.