Class cv::Moments#
struct returned by cv::moments View details
#include <opencv2/core/types.hpp>Collaboration diagram for cv::Moments:
Detailed Description#
struct returned by cv::moments
The spatial moments \(\texttt{Moments::m}_{ji}\) are computed as:
The central moments \(\texttt{Moments::mu}_{ji}\) are computed as:
where \((\bar{x}, \bar{y})\) is the mass center:
The normalized central moments \(\texttt{Moments::nu}_{ij}\) are computed as:
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
\(\texttt{mu}_{00}=\texttt{m}_{00}\), \(\texttt{nu}_{00}=1\) \(\texttt{nu}_{10}=\texttt{mu}_{10}=\texttt{mu}_{01}=\texttt{mu}_{10}=0\) , hence the values are not stored.
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.
Constructor & Destructor Documentation#
Moments()#
the default constructor
Moments()#
cv::Moments::Moments(
double m00,
double m10,
double m01,
double m20,
double m11,
double m02,
double m30,
double m21,
double m12,
double m03 )
the full constructor
Member Data Documentation#
nu20#
double cv::Moments::nu20
nu11#
double cv::Moments::nu11
nu02#
double cv::Moments::nu02
nu30#
double cv::Moments::nu30
nu21#
double cv::Moments::nu21
nu12#
double cv::Moments::nu12
nu03#
double cv::Moments::nu03
Source file#
The documentation for this class was generated from the following file:
opencv2/core/types.hpp