Visual Servoing Platform
version 3.5.0 under development (2022-02-15)
|
#include <visp3/core/vpMomentCentered.h>
Public Member Functions | |
vpMomentCentered () | |
virtual | ~vpMomentCentered () |
void | compute () |
double | get (unsigned int i, unsigned int j) const |
const std::vector< double > & | get () const |
const char * | name () const |
void | printWithIndices (std::ostream &os) const |
void | printDependencies (std::ostream &os) const |
Inherited functionalities from vpMoment | |
const vpMomentObject & | getObject () const |
void | linkTo (vpMomentDatabase &moments) |
void | update (vpMomentObject &object) |
Protected Member Functions | |
void | set (unsigned int i, unsigned int j, double value) |
vpMomentDatabase & | getMoments () const |
Protected Attributes | |
std::vector< double > | values |
Friends | |
VISP_EXPORT std::ostream & | operator<< (std::ostream &os, const vpMomentCentered &v) |
This class defines the double-indexed centered moment descriptor .
In the case of a dense object O, centered moments are defined by:
In the case of a discrete set of n points, centered moments are defined by:
where are the coordinates of the center of gravity.
The centered moments are computed from the object at the highest possible order. For example if the vpMomentObject is defined up to order 5, vpMomentCentered will be too.
Values of vpMomentCentered may be accessed by one of the two vpMomentCentered::get methods. When using vpMomentCentered::get (), the format of the return vector is the following: is stored at vpMomentCentered::get ()[j* (vpMomentObject::getOrder () +1)+i]
vpMomentCentered depends on vpMomentGravityCenter.
Definition at line 79 of file vpMomentCentered.h.
vpMomentCentered::vpMomentCentered | ( | ) |
Default constructor.
Definition at line 95 of file vpMomentCentered.cpp.
|
inlinevirtual |
Definition at line 83 of file vpMomentCentered.h.
References vpMoment::compute().
|
virtual |
Computes centered moments of all available orders. Depends on vpMomentGravityCenter.
Implements vpMoment.
Definition at line 65 of file vpMomentCentered.cpp.
References vpMath::comb(), vpMomentGravityCenter::get(), vpMomentDatabase::get(), vpMomentObject::get(), vpMoment::getMoments(), vpMoment::getObject(), vpMomentObject::getOrder(), vpException::notInitialized, and vpMoment::values.
Referenced by vpMomentCommon::getAlpha(), vpMomentCommon::getMu3(), vpMomentCommon::getSurface(), and vpMomentCommon::updateAll().
double vpMomentCentered::get | ( | unsigned int | i, |
unsigned int | j | ||
) | const |
Gets the desired moment using indexes.
i | : first index of the centered moment. |
j | : second index of the centered moment. |
Definition at line 103 of file vpMomentCentered.cpp.
References vpException::badValue, vpMoment::getObject(), vpMomentObject::getOrder(), and vpMoment::values.
Referenced by vpMomentArea::compute(), vpMomentAreaNormalized::compute(), vpMomentCInvariant::compute(), vpMomentAlpha::compute(), vpFeatureMomentCentered::compute_interaction(), vpFeatureMomentAlpha::compute_interaction(), vpFeatureMomentAreaNormalized::compute_interaction(), vpFeatureMomentGravityCenter::compute_interaction(), vpFeatureMomentCInvariant::compute_interaction(), vpFeatureMomentGravityCenterNormalized::compute_interaction(), vpMomentCommon::getMu3(), vpMomentCommon::getSurface(), vpMomentArea::printDependencies(), vpMomentAreaNormalized::printDependencies(), vpMomentAlpha::printDependencies(), and vpMomentCInvariant::vpMomentCInvariant().
|
inline |
Returns all centered moment values with where order is the object's order.
For example, if the maximal order is 3, the following values are provided:
To have a better reading of the moments you can picture them as a triangular matrix:
The moments of the same order are on each of the matrix reverse diagonals. To access for example to the centered moment , you should use this kind of code:
Definition at line 135 of file vpMomentCentered.h.
References vpMoment::get().
|
inlineprotectedinherited |
Returns the linked moment database.
Definition at line 123 of file vpMoment.h.
Referenced by vpMomentArea::compute(), vpMomentGravityCenterNormalized::compute(), compute(), vpMomentAreaNormalized::compute(), vpMomentCInvariant::compute(), vpMomentAlpha::compute(), vpMomentArea::printDependencies(), vpMomentGravityCenterNormalized::printDependencies(), printDependencies(), vpMomentAreaNormalized::printDependencies(), and vpMomentAlpha::printDependencies().
|
inlineinherited |
Definition at line 150 of file vpMoment.h.
Referenced by vpMomentArea::compute(), compute(), vpMomentGravityCenter::compute(), vpMomentAreaNormalized::compute(), vpMomentCInvariant::compute(), vpFeatureMomentArea::compute_interaction(), vpFeatureMomentBasic::compute_interaction(), vpFeatureMomentCentered::compute_interaction(), vpFeatureMomentAlpha::compute_interaction(), vpFeatureMomentAreaNormalized::compute_interaction(), vpFeatureMomentGravityCenter::compute_interaction(), vpFeatureMomentCInvariant::compute_interaction(), vpFeatureMomentGravityCenterNormalized::compute_interaction(), vpMomentBasic::get(), get(), vpFeatureMomentBasic::interaction(), vpFeatureMomentCentered::interaction(), vpMomentArea::printDependencies(), vpMomentBasic::printDependencies(), printDependencies(), vpMomentGravityCenter::printDependencies(), vpMomentAreaNormalized::printDependencies(), printWithIndices(), set(), and vpMomentCInvariant::vpMomentCInvariant().
|
inherited |
Links the moment to a database of moment primitives. If the moment depends on other moments, these moments must be linked to the same database.
data_base | : database of moment primitives. |
Definition at line 98 of file vpMoment.cpp.
References vpException::memoryAllocationError, and vpMoment::name().
Referenced by vpMomentCommon::getAlpha(), vpMomentCommon::getMu3(), vpMomentCommon::getSurface(), and vpMomentCommon::vpMomentCommon().
|
inlinevirtual |
Moment name.
Implements vpMoment.
Definition at line 92 of file vpMomentCentered.h.
References vpMoment::operator<<, and vpMoment::printDependencies().
|
virtual |
Prints moments required for calculation of vpMomentCentered, which are
Reimplemented from vpMoment.
Definition at line 172 of file vpMomentCentered.cpp.
References vpMomentDatabase::get(), vpMoment::getMoments(), vpMoment::getObject(), vpMomentGravityCenter::getXg(), vpMomentGravityCenter::getYg(), vpException::notInitialized, and vpMomentObject::printWithIndices().
void vpMomentCentered::printWithIndices | ( | std::ostream & | os | ) | const |
Print in a readable form which looks better than output from << operator
Definition at line 154 of file vpMomentCentered.cpp.
References vpMoment::getObject(), and vpMomentObject::getOrder().
|
protected |
To set the values of centred moments. Required when normalizing the moment values.
i | : first index of the 2D moment. |
j | : second index of the 2D moment. |
value | : value of the moment. |
Definition at line 52 of file vpMomentCentered.cpp.
References vpException::badValue, vpMoment::getObject(), vpMomentObject::getOrder(), and vpMoment::values.
|
inherited |
Updates the moment with the current object. This does not compute any values.
moment_object | : object descriptor of the current camera vision. |
Definition at line 115 of file vpMoment.cpp.
|
friend |
Outputs the centered moment's values to a stream presented as a matrix. The first line corresponds to , the second one to Values in table corresponding to a higher order are marked with an "x" and not computed.
For example, if the maximal order is 3, the following values are provided:
This output will be followed by an output with indexes as produced by printWithIndices() function
Definition at line 133 of file vpMomentCentered.cpp.
|
protectedinherited |
Definition at line 118 of file vpMoment.h.
Referenced by vpMomentArea::compute(), vpMomentGravityCenterNormalized::compute(), compute(), vpMomentGravityCenter::compute(), vpMomentAreaNormalized::compute(), vpMomentCInvariant::compute(), vpMomentAlpha::compute(), get(), vpMomentGravityCenter::get(), vpMomentCInvariant::getMomentVector(), set(), vpMomentAlpha::vpMomentAlpha(), vpMomentArea::vpMomentArea(), vpMomentAreaNormalized::vpMomentAreaNormalized(), vpMomentCInvariant::vpMomentCInvariant(), and vpMomentGravityCenter::vpMomentGravityCenter().