@Namespace(value="cv") @NoOffset @Properties(inherit=opencv_core.class) public class Moments extends Pointer
///////////////////////// raster image moments //////////////////////////
\addtogroup imgproc_shape \{
/** \brief 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
\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.
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
Moments()
the default constructor
|
Moments(double m00,
double m10,
double m01,
double m20,
double m11,
double m02,
double m30,
double m21,
double m12,
double m03)
the full constructor
|
Moments(long size)
Native array allocator.
|
Moments(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
m00()
\name spatial moments
\{
|
Moments |
m00(double setter) |
double |
m01() |
Moments |
m01(double setter) |
double |
m02() |
Moments |
m02(double setter) |
double |
m03() |
Moments |
m03(double setter) |
double |
m10() |
Moments |
m10(double setter) |
double |
m11() |
Moments |
m11(double setter) |
double |
m12() |
Moments |
m12(double setter) |
double |
m20() |
Moments |
m20(double setter) |
double |
m21() |
Moments |
m21(double setter) |
double |
m30() |
Moments |
m30(double setter) |
double |
mu02() |
Moments |
mu02(double setter) |
double |
mu03() |
Moments |
mu03(double setter) |
double |
mu11() |
Moments |
mu11(double setter) |
double |
mu12() |
Moments |
mu12(double setter) |
double |
mu20()
\}
|
Moments |
mu20(double setter) |
double |
mu21() |
Moments |
mu21(double setter) |
double |
mu30() |
Moments |
mu30(double setter) |
double |
nu02() |
Moments |
nu02(double setter) |
double |
nu03() |
Moments |
nu03(double setter) |
double |
nu11() |
Moments |
nu11(double setter) |
double |
nu12() |
Moments |
nu12(double setter) |
double |
nu20()
\}
|
Moments |
nu20(double setter) |
double |
nu21() |
Moments |
nu21(double setter) |
double |
nu30() |
Moments |
nu30(double setter) |
Moments |
position(long position) |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zero
public Moments(Pointer p)
Pointer.Pointer(Pointer)
.public Moments(long size)
Pointer.position(long)
.public Moments()
public Moments(double m00, double m10, double m01, double m20, double m11, double m02, double m30, double m21, double m12, double m03)
public double m00()
public Moments m00(double setter)
public double m10()
public Moments m10(double setter)
public double m01()
public Moments m01(double setter)
public double m20()
public Moments m20(double setter)
public double m11()
public Moments m11(double setter)
public double m02()
public Moments m02(double setter)
public double m30()
public Moments m30(double setter)
public double m21()
public Moments m21(double setter)
public double m12()
public Moments m12(double setter)
public double m03()
public Moments m03(double setter)
public double mu20()
\name central moments \{
public Moments mu20(double setter)
public double mu11()
public Moments mu11(double setter)
public double mu02()
public Moments mu02(double setter)
public double mu30()
public Moments mu30(double setter)
public double mu21()
public Moments mu21(double setter)
public double mu12()
public Moments mu12(double setter)
public double mu03()
public Moments mu03(double setter)
public double nu20()
\name central normalized moments \{
public Moments nu20(double setter)
public double nu11()
public Moments nu11(double setter)
public double nu02()
public Moments nu02(double setter)
public double nu30()
public Moments nu30(double setter)
public double nu21()
public Moments nu21(double setter)
public double nu12()
public Moments nu12(double setter)
public double nu03()
public Moments nu03(double setter)
Copyright © 2020. All rights reserved.