EstervQrCode 1.1.1
Library for qr code manipulation
Public Member Functions | List of all members

struct returned by cv::moments More...

#include <types.hpp>

Public Member Functions

 Moments ()
 the default constructor More...
 
 Moments (double m00, double m10, double m01, double m20, double m11, double m02, double m30, double m21, double m12, double m03)
 the full constructor More...
 

Public Attributes

spatial moments
CV_PROP_RW double m00
 
CV_PROP_RW double m10
 
CV_PROP_RW double m01
 
CV_PROP_RW double m20
 
CV_PROP_RW double m11
 
CV_PROP_RW double m02
 
CV_PROP_RW double m30
 
CV_PROP_RW double m21
 
CV_PROP_RW double m12
 
CV_PROP_RW double m03
 
central moments
CV_PROP_RW double mu20
 
CV_PROP_RW double mu11
 
CV_PROP_RW double mu02
 
CV_PROP_RW double mu30
 
CV_PROP_RW double mu21
 
CV_PROP_RW double mu12
 
CV_PROP_RW double mu03
 
central normalized moments
CV_PROP_RW double nu20
 
CV_PROP_RW double nu11
 
CV_PROP_RW double nu02
 
CV_PROP_RW double nu30
 
CV_PROP_RW double nu21
 
CV_PROP_RW double nu12
 
CV_PROP_RW double nu03
 

Detailed Description

struct returned by cv::moments

The spatial moments $\texttt{Moments::m}_{ji}$ are computed as:

\[\texttt{m} _{ji}= \sum _{x,y} \left ( \texttt{array} (x,y) \cdot x^j \cdot y^i \right )\]

The central moments $\texttt{Moments::mu}_{ji}$ are computed as:

\[\texttt{mu} _{ji}= \sum _{x,y} \left ( \texttt{array} (x,y) \cdot (x - \bar{x} )^j \cdot (y - \bar{y} )^i \right )\]

where $(\bar{x}, \bar{y})$ is the mass center:

\[\bar{x} = \frac{\texttt{m}_{10}}{\texttt{m}_{00}} , \; \bar{y} = \frac{\texttt{m}_{01}}{\texttt{m}_{00}}\]

The normalized central moments $\texttt{Moments::nu}_{ij}$ are computed as:

\[\texttt{nu} _{ji}= \frac{\texttt{mu}_{ji}}{\texttt{m}_{00}^{(i+j)/2+1}} .\]

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.

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.

Constructor & Destructor Documentation

◆ Moments() [1/2]

cv::Moments::Moments ( )

the default constructor

◆ Moments() [2/2]

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

◆ m00

CV_PROP_RW double cv::Moments::m00

◆ m01

CV_PROP_RW double cv::Moments::m01

◆ m02

CV_PROP_RW double cv::Moments::m02

◆ m03

CV_PROP_RW double cv::Moments::m03

◆ m10

CV_PROP_RW double cv::Moments::m10

◆ m11

CV_PROP_RW double cv::Moments::m11

◆ m12

CV_PROP_RW double cv::Moments::m12

◆ m20

CV_PROP_RW double cv::Moments::m20

◆ m21

CV_PROP_RW double cv::Moments::m21

◆ m30

CV_PROP_RW double cv::Moments::m30

◆ mu02

CV_PROP_RW double cv::Moments::mu02

◆ mu03

CV_PROP_RW double cv::Moments::mu03

◆ mu11

CV_PROP_RW double cv::Moments::mu11

◆ mu12

CV_PROP_RW double cv::Moments::mu12

◆ mu20

CV_PROP_RW double cv::Moments::mu20

◆ mu21

CV_PROP_RW double cv::Moments::mu21

◆ mu30

CV_PROP_RW double cv::Moments::mu30

◆ nu02

CV_PROP_RW double cv::Moments::nu02

◆ nu03

CV_PROP_RW double cv::Moments::nu03

◆ nu11

CV_PROP_RW double cv::Moments::nu11

◆ nu12

CV_PROP_RW double cv::Moments::nu12

◆ nu20

CV_PROP_RW double cv::Moments::nu20

◆ nu21

CV_PROP_RW double cv::Moments::nu21

◆ nu30

CV_PROP_RW double cv::Moments::nu30

The documentation for this class was generated from the following file: