CVBpy 15.0
ImageMoments Class Reference

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

Inherits object.

Public Member Functions

float central_moment (self, int x_order, int y_order, int normalization)
 Gets one of the central image moments. More...
 
cvb.foundation.HuMoments hu_moments (self)
 Gets the seven Hu moments of the image. More...
 
float spatial_moment (self, int x_order, int y_order, int normalization, Optional[cvb.Point2D] offset)
 Gets one of the spatial image moments. More...
 

Properties

 calculation_preference = property
 int: The preference of speed versus accuracy chosen, when this object was created (see cvb.foundation.MomentsCalculation).
 

Detailed Description

State object for calculating various image moments.

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

Parameters

image_plane : cvb.ImagePlane Plane on which to calculate the moments.

aoi : Optional[cvb.Rect] Area of interest to calculate the moments (default entire plane).

preference : int Speed or accuracy, MomentsCalculation.FavorNone by default.

Member Function Documentation

◆ central_moment()

float central_moment (   self,
int  x_order,
int  y_order,
int  normalization 
)

Gets one of the central image moments.

Parameters

x_order : int X-order of the moment to retrieve (see cvb.foundation.MomentsOrder).

y_order : int Y-order of the moment to retrieve (see cvb.foundation.MomentsOrder).

normalization : int Whether or not to normalize (see cvb.foundation.MomentsNormalization).

Returns

float The central moment.

◆ hu_moments()

cvb.foundation.HuMoments hu_moments (   self)

Gets the seven Hu moments of the image.

Returns

cvb.foundation.HuMoments Hu moments.

◆ spatial_moment()

float spatial_moment (   self,
int  x_order,
int  y_order,
int  normalization,
Optional[cvb.Point2D offset 
)

Gets one of the spatial image moments.

Parameters

x_order : int X-order of the moment to retrieve (see cvb.foundation.MomentsOrder).

y_order : int Y-order of the moment to retrieve (see cvb.foundation.MomentsOrder).

normalization : int Whether or not to normalize (see cvb.foundation.MomentsNormalization).

offset : Optional[cvb.Point2D] Offset of the moments (optional, by default uses the offset used when creating this object).

Returns

float The spatial moment.