Visual Servoing Platform
version 3.6.1 under development (2024-11-21)
|
#include <visp3/core/vpMomentCommon.h>
Public Member Functions | |
vpMomentCommon (double dstSurface, const std::vector< double > &ref, double refAlpha, double dstZ=1.0, bool flg_sxsyfromnormalized=false) | |
virtual | ~vpMomentCommon () VP_OVERRIDE |
void | updateAll (vpMomentObject &object) VP_OVERRIDE |
Inherited functionalities from vpMomentDatabase | |
const vpMoment & | get (const std::string &moment_name, bool &found) const |
vpMoment & | get_first () |
Static Public Member Functions | |
static double | getAlpha (vpMomentObject &object) |
static std::vector< double > | getMu3 (vpMomentObject &object) |
static double | getSurface (vpMomentObject &object) |
This class initializes and allows access to commonly used moments.
It is a vpMomentDatabase filled with the following moments:
There is no need to do the linkTo operations manually nor is it necessary to care about the order of moment computation.
This class carries an vpMomentCommon::updateAll() method capable of updating AND computing moments from an object (see 4-step process in vpMoment). The moments computed by this class are classical moments used in moment-based visual servoing. For more information see [48].
To initialize this moment set the user needs to compute the following things:
Shortcuts for each of these prerequisites are provided by this class except depth (methods vpMomentCommon::getMu3(), vpMomentCommon::getSurface(), vpMomentCommon::getAlpha()).
Definition at line 100 of file vpMomentCommon.h.
BEGIN_VISP_NAMESPACE vpMomentCommon::vpMomentCommon | ( | double | dstSurface, |
const std::vector< double > & | ref, | ||
double | refAlpha, | ||
double | dstZ = 1.0 , |
||
bool | flg_sxsyfromnormalized = false |
||
) |
Default constructor. Initializes the common database with the following moments: basic, gravity,centered,centered+normalized,normalized gravity,normalized surface, scale-plane-rotation-translation invariant, alpha, symmetric invariant.
dstSurface | : destination surface. You may use vpMomentCommon::getSurface(). |
ref | : reference 3rd order moments (see vpMomentAlpha). You may use vpMomentCommon::getMu3(). |
refAlpha | : reference alpha (see vpMomentAlpha). You may use vpMomentCommon::getAlpha(). |
dstZ | : destination depth. |
flg_sxsyfromnormalized | : flag to enable calculation of sx,sy from normalized moments. |
Definition at line 55 of file vpMomentCommon.cpp.
References vpMoment::linkTo().
|
virtual |
Definition at line 230 of file vpMomentCommon.cpp.
|
inherited |
Retrieves a moment from the database.
moment_name | : Name of the moment's class. |
found | : true if the moment's type exists in the database, false otherwise. |
Definition at line 65 of file vpMomentDatabase.cpp.
Referenced by vpMomentAlpha::compute(), vpMomentArea::compute(), vpMomentAreaNormalized::compute(), vpMomentCentered::compute(), vpMomentCInvariant::compute(), vpMomentGravityCenterNormalized::compute(), vpFeatureMomentAlpha::compute_interaction(), vpFeatureMomentArea::compute_interaction(), vpFeatureMomentAreaNormalized::compute_interaction(), vpFeatureMomentCentered::compute_interaction(), vpFeatureMomentCInvariant::compute_interaction(), vpFeatureMomentGravityCenter::compute_interaction(), vpFeatureMomentGravityCenterNormalized::compute_interaction(), vpMomentAlpha::printDependencies(), vpMomentArea::printDependencies(), vpMomentAreaNormalized::printDependencies(), vpMomentCentered::printDependencies(), vpMomentGravityCenterNormalized::printDependencies(), and vpFeatureMoment::update().
|
inlineinherited |
Get the first element in the database. May be useful in case an unnamed object is present but is the only element in the database.
Definition at line 158 of file vpMomentDatabase.h.
|
static |
Gets a reference alpha of an object.
object | : Moment object. |
Definition at line 180 of file vpMomentCommon.cpp.
References vpMomentAlpha::compute(), vpMomentCentered::compute(), vpMomentGravityCenter::compute(), vpMomentAlpha::get(), vpMoment::linkTo(), and vpMomentDatabase::updateAll().
|
static |
Gets the reference 3rd order moments of an object.
object | : Moment object. |
Definition at line 203 of file vpMomentCommon.cpp.
References vpMomentCentered::compute(), vpMomentGravityCenter::compute(), vpMomentCentered::get(), vpMoment::linkTo(), and vpMomentDatabase::updateAll().
|
static |
Gets the surface of an object
object | : moment object |
Definition at line 153 of file vpMomentCommon.cpp.
References vpMomentCentered::compute(), vpMomentGravityCenter::compute(), vpMomentObject::DISCRETE, vpMomentCentered::get(), vpMoment::linkTo(), and vpMomentDatabase::updateAll().
|
virtual |
Updates all moments in the database with the object and computes all their values. This is possible because this particular database knows the link between the moments it contains. The order of computation is as follows: vpMomentGravityCenter,vpMomentCentered,vpMomentAlpha,vpMomentCInvariant,vpMomentSInvariant,vpMomentAreaNormalized,vpMomentGravityCenterNormalized
object | : Moment object. |
Example of using a preconfigured database to compute one of the C-invariants:
Reimplemented from vpMomentDatabase.
Definition at line 130 of file vpMomentCommon.cpp.
References vpMomentAlpha::compute(), vpMomentArea::compute(), vpMomentAreaNormalized::compute(), vpMomentCentered::compute(), vpMomentCInvariant::compute(), vpMomentGravityCenter::compute(), vpMomentGravityCenterNormalized::compute(), vpException::getStringMessage(), and vpMomentDatabase::updateAll().