In case of a raster image, the spatial moments :math:`\texttt{Moments::m}_{ji}` are computed as:
...
...
@@ -66,6 +74,10 @@ The normalized central moments
The moments of a contour are defined in the same way but computed using the Green's formula (see http://en.wikipedia.org/wiki/Green_theorem). So, due to a limited raster resolution, the moments computed for a contour are slightly different from the moments computed for the same rasterized contour.
.. note::
Since the contour moments are computed using Green formula, you may get seemingly odd results for contours with self-intersections, e.g. a zero area (``m00``) for butterfly-shaped contours.
.. seealso::
:ocv:func:`contourArea`,
...
...
@@ -342,6 +354,7 @@ The function computes a contour area. Similarly to
:ocv:func:`moments` , the area is computed using the Green formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using
:ocv:func:`drawContours` or
:ocv:func:`fillPoly` , can be different.
Also, the function will most certainly give a wrong results for contours with self-intersections.