CVB++ 14.0
ImageMoments Class Reference

State object for calculating various image moments. More...

#include <cvb/foundation/moments.hpp>

Public Member Functions

 ImageMoments (const ImagePlane &imagePlane, Rect< int > aoi, MomentsCalculation preference=MomentsCalculation::FavorNone)
 Calculate the moments on the input ImagePlane and area of interest. More...
 
 ImageMoments (const ImagePlane &imagePlane, MomentsCalculation preference=MomentsCalculation::FavorNone)
 Calculate the moments on the input imagePlane. More...
 
 ImageMoments (ImageMoments &&) noexcept=default
 Move constructor.
 
ImageMomentsoperator= (ImageMoments &&) noexcept=default
 Move assignment operator.
 
MomentsCalculation CalculationPreference () const noexcept
 The preference of speed versus accuracy chosen when this object was created. More...
 
void * Handle () const noexcept
 Classic API IMGMOMENTS handle. More...
 
double SpatialMoment (MomentsOrder xOrder, MomentsOrder yOrder, MomentsNormalization normalization, Point2D< int > offset)
 Get one of the spatial image moments. More...
 
double SpatialMoment (MomentsOrder xOrder, MomentsOrder yOrder, MomentsNormalization normalization)
 Get one of the spatial image moments. More...
 
double CentralMoment (MomentsOrder xOrder, MomentsOrder yOrder, MomentsNormalization normalization)
 Get one of the central image moments. More...
 
HuMoments HuMoments ()
 Get the seven Hu moments of the image. More...
 

Static Public Member Functions

static std::unique_ptr< ImageMomentsCalculate (const ImagePlane &imagePlane, Rect< int > aoi, MomentsCalculation preference=MomentsCalculation::FavorNone)
 Calculate the moments on the input imagePlane and aoi. More...
 
static std::unique_ptr< ImageMomentsCalculate (const ImagePlane &imagePlane, MomentsCalculation preference=MomentsCalculation::FavorNone)
 Calculate the moments on the input imagePlane. More...
 

Detailed Description

State object for calculating various image moments.

Constructor & Destructor Documentation

◆ ImageMoments() [1/2]

ImageMoments ( const ImagePlane imagePlane,
Rect< int >  aoi,
MomentsCalculation  preference = MomentsCalculation::FavorNone 
)
inline

Calculate the moments on the input ImagePlane and area of interest.

Parameters
[in]imagePlanePlane to calculate the moments.
[in]aoiArea of interest to calculate the moments in.
[in]preferenceSpeed or accuracy.
Returns
Moments object.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ ImageMoments() [2/2]

ImageMoments ( const ImagePlane imagePlane,
MomentsCalculation  preference = MomentsCalculation::FavorNone 
)
inline

Calculate the moments on the input imagePlane.

Parameters
[in]imagePlanePlane on which to calculate the moments.
[in]preferenceSpeed or accuracy.
Returns
Moments object.
Exceptions
Anyexception derived from std::exception including CvbException.

Member Function Documentation

◆ Calculate() [1/2]

static std::unique_ptr< ImageMoments > Calculate ( const ImagePlane imagePlane,
MomentsCalculation  preference = MomentsCalculation::FavorNone 
)
inlinestatic

Calculate the moments on the input imagePlane.

Parameters
[in]imagePlanePlane on which to calculate the moments.
[in]preferenceSpeed or accuracy.
Returns
Pointer to the created moments object.
Exceptions
Doesnot throw any exception.

◆ Calculate() [2/2]

static std::unique_ptr< ImageMoments > Calculate ( const ImagePlane imagePlane,
Rect< int >  aoi,
MomentsCalculation  preference = MomentsCalculation::FavorNone 
)
inlinestatic

Calculate the moments on the input imagePlane and aoi.

Parameters
[in]imagePlanePlane on which to calculate the moments.
[in]aoiArea of interest to calculate the moments.
[in]preferenceSpeed or accuracy.
Returns
Pointer to the created moments object.
Exceptions
Doesnot throw any exception.

◆ CalculationPreference()

MomentsCalculation CalculationPreference ( ) const
inlinenoexcept

The preference of speed versus accuracy chosen when this object was created.

Returns
The preference value.
Exceptions
Doesnot throw any exception.

◆ CentralMoment()

double CentralMoment ( MomentsOrder  xOrder,
MomentsOrder  yOrder,
MomentsNormalization  normalization 
)
inline

Get one of the central image moments.

Parameters
[in]xOrderX order of the moment to retrieve.
[in]yOrderY order of the moment to retrieve.
[in]normalizationWhether or not to normalize.
Returns
The central moment.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Handle()

void * Handle ( ) const
inlinenoexcept

Classic API IMGMOMENTS handle.

Returns
Classic API handle.
Exceptions
Doesnot throw any exception.

It is normally not necessary to work with this handle.

◆ HuMoments()

HuMoments HuMoments ( )
inline

Get the seven Hu moments of the image.

Returns
Hu moments.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ SpatialMoment() [1/2]

double SpatialMoment ( MomentsOrder  xOrder,
MomentsOrder  yOrder,
MomentsNormalization  normalization 
)
inline

Get one of the spatial image moments.

Parameters
[in]xOrderX order of the moment to retrieve.
[in]yOrderY order of the moment to retrieve.
[in]normalizationWhether or not to normalize.
Returns
The spatial moment.
Exceptions
Anyexception derived from std::exception including CvbException.

This overload automatically uses the offset used in creating this object.

◆ SpatialMoment() [2/2]

double SpatialMoment ( MomentsOrder  xOrder,
MomentsOrder  yOrder,
MomentsNormalization  normalization,
Point2D< int >  offset 
)
inline

Get one of the spatial image moments.

Parameters
[in]xOrderX order of the moment to retrieve.
[in]yOrderY order of the moment to retrieve.
[in]normalizationWhether or not to normalize.
[in]offsetOffset of the moments.
Returns
The spatial moment.
Exceptions
Anyexception derived from std::exception including CvbException.