Visual Servoing Platform  version 3.4.0
vpFeatureMomentCentered Class Reference

#include <vpFeatureMomentCentered.h>

+ Inheritance diagram for vpFeatureMomentCentered:

Public Types

enum  { FEATURE_ALL = 0xffff }
 
enum  vpBasicFeatureDeallocatorType { user, vpServo }
 

Public Member Functions

 vpFeatureMomentCentered (vpMomentDatabase &moments, double A, double B, double C, vpFeatureMomentDatabase *featureMoments=NULL)
 
void compute_interaction ()
 
vpMatrix interaction (unsigned int select_one, unsigned int select_two) const
 
const char * momentName () const
 
const char * name () const
 
Inherited functionalities from vpFeatureMoment
vpBasicFeatureduplicate () const
 
void display (const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const
 
void display (const vpCameraParameters &cam, const vpImage< vpRGBa > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const
 
int getDimension (unsigned int select=FEATURE_ALL) const
 
void init (void)
 
vpMatrix interaction (unsigned int select=FEATURE_ALL)
 
void linkTo (vpFeatureMomentDatabase &featureMoments)
 
void print (unsigned int select=FEATURE_ALL) const
 
virtual void printDependencies (std::ostream &os) const
 
void update (double A, double B, double C)
 
Inherited functionalities from vpBasicFeature
unsigned int dimension_s ()
 
virtual vpColVector error (const vpBasicFeature &s_star, unsigned int select=FEATURE_ALL)
 
vpColVector get_s (unsigned int select=FEATURE_ALL) const
 
vpBasicFeatureDeallocatorType getDeallocate ()
 
virtual double operator[] (unsigned int i) const
 
void setDeallocate (vpBasicFeatureDeallocatorType d)
 
void setFlags ()
 

Static Public Member Functions

static unsigned int selectAll ()
 

Static Public Attributes

static const unsigned int FEATURE_LINE [32]
 

Protected Member Functions

vpMatrix compute_Lmu_pq (const unsigned int &p, const unsigned int &q, const double &xg, const double &yg, const vpMatrix &L_xg, const vpMatrix &L_yg, const vpMomentBasic &m, const vpFeatureMomentBasic &feature_moment_m) const
 
const vpMomentgetMoment () const
 
void resetFlags ()
 

Protected Attributes

unsigned int order
 
const vpMomentmoment
 
vpMomentDatabasemoments
 
vpFeatureMomentDatabasefeatureMomentsDataBase
 
std::vector< vpMatrixinteraction_matrices
 
double A
 
double B
 
double C
 
char _name [255]
 
vpColVector s
 
unsigned int dim_s
 
bool * flags
 
unsigned int nbParameters
 
vpBasicFeatureDeallocatorType deallocate
 

Friends

VISP_EXPORT std::ostream & operator<< (std::ostream &os, const vpFeatureMomentCentered &v)
 

Detailed Description

Functionality computation for centered moment feature. Computes the interaction matrix associated with vpMomentCentered.

The interaction matrix for the feature is defined in [41], equation (17). This vpFeatureMoment, as well as it's corresponding moment primitive is double-indexed. The interaction matrix $ L_{\mu_{ij}} $ is obtained by calling vpFeatureMomentBasic::interaction (i,j) and is associated to $ \mu_{ij} $ obtained by vpFeatureMomentCentered::get (i,j).

vpFeatureMomentCentered computes interaction matrices all interaction matrices up to vpMomentObject::getOrder()-1.

Attention
The maximum order reached by vpFeatureMomentBasic is NOT the maximum order of the vpMomentObject, it is one unit smaller. For example if you define your vpMomentObject up to order n then vpFeatureMomentBasic will be able to compute interaction matrices up to order n-1 that is $ L_{m_{ij}} $ with $ i+j<=n-1 $.

This feature depends on:

Definition at line 78 of file vpFeatureMomentCentered.h.

Member Enumeration Documentation

anonymous enum
inherited
Enumerator
FEATURE_ALL 

Definition at line 82 of file vpBasicFeature.h.

Indicates who should deallocate the feature.

Enumerator
user 
vpServo 

Definition at line 88 of file vpBasicFeature.h.

Constructor & Destructor Documentation

vpFeatureMomentCentered::vpFeatureMomentCentered ( vpMomentDatabase moments_,
double  A_,
double  B_,
double  C_,
vpFeatureMomentDatabase featureMoments = NULL 
)

Default constructor

Parameters
moments_: Database of moment primitives.
A_: First plane coefficient for a plane equation of the following type Ax+By+C=1/Z.
B_: Second plane coefficient for a plane equation of the following type Ax+By+C=1/Z.
C_: Third plane coefficient for a plane equation of the following type Ax+By+C=1/Z.
featureMoments: Database of features.

Definition at line 61 of file vpFeatureMomentCentered.cpp.

Member Function Documentation

vpMatrix vpFeatureMomentCentered::compute_Lmu_pq ( const unsigned int &  p,
const unsigned int &  q,
const double &  xg,
const double &  yg,
const vpMatrix L_xg,
const vpMatrix L_yg,
const vpMomentBasic m,
const vpFeatureMomentBasic feature_moment_m 
) const
protected

Core computation of interaction matrix for moment m_pq

Core function for the interaction matrix computation for moment m_pq Given its dependent moment and interaction matrices, computes the interaction matrix of centred moments

Definition at line 87 of file vpFeatureMomentCentered.cpp.

References vpMath::comb(), vpMomentBasic::get(), and vpFeatureMomentBasic::interaction().

Referenced by compute_interaction().

unsigned int vpBasicFeature::dimension_s ( )
inlineinherited

Return the dimension of the feature vector $\bf s$.

Definition at line 110 of file vpBasicFeature.h.

References vpColor::green.

void vpFeatureMoment::display ( const vpCameraParameters cam,
const vpImage< unsigned char > &  I,
const vpColor color = vpColor::green,
unsigned int  thickness = 1 
) const
virtualinherited

Not implemented since visual representation of a moment doesn't often make sense.

Implements vpBasicFeature.

Definition at line 114 of file vpFeatureMoment.cpp.

void vpFeatureMoment::display ( const vpCameraParameters cam,
const vpImage< vpRGBa > &  I,
const vpColor color = vpColor::green,
unsigned int  thickness = 1 
) const
virtualinherited

Not implemented since visual representation of a moment doesn't often make sense.

Implements vpBasicFeature.

Definition at line 128 of file vpFeatureMoment.cpp.

vpBasicFeature * vpFeatureMoment::duplicate ( ) const
virtualinherited

Duplicates the feature into a vpGenericFeature harbouring the same properties. The resulting feature is of vpMomentGenericFeature type. While it still can compute interaction matrices and has acces to it's moment primitive, it has lost all precise information about its precise type and therefore cannot be used in a feature database.

Returns
The corresponding feature.

Implements vpBasicFeature.

Definition at line 220 of file vpFeatureMoment.cpp.

References vpFeatureMoment::A, vpFeatureMoment::B, vpFeatureMoment::C, vpBasicFeature::dim_s, vpFeatureMoment::featureMomentsDataBase, vpBasicFeature::flags, vpFeatureMoment::interaction_matrices, vpFeatureMoment::moment, vpFeatureMoment::moments, vpBasicFeature::nbParameters, vpColVector::resize(), and vpBasicFeature::s.

vpBasicFeatureDeallocatorType vpBasicFeature::getDeallocate ( )
inlineinherited

Definition at line 123 of file vpBasicFeature.h.

int vpFeatureMoment::getDimension ( unsigned int  select = FEATURE_ALL) const
inherited

Feature's dimension according to selection.

Definition at line 85 of file vpFeatureMoment.cpp.

References vpBasicFeature::dim_s, and vpBasicFeature::FEATURE_LINE.

const vpMoment& vpFeatureMoment::getMoment ( ) const
inlineprotectedinherited

Definition at line 163 of file vpFeatureMoment.h.

void vpFeatureMoment::init ( void  )
virtualinherited

Initialize common parameters for moment features.

Implements vpBasicFeature.

Definition at line 56 of file vpFeatureMoment.cpp.

References vpBasicFeature::dim_s, vpBasicFeature::flags, vpMoment::get(), vpFeatureMoment::moment, vpBasicFeature::nbParameters, vpColVector::resize(), and vpBasicFeature::s.

vpMatrix vpFeatureMomentCentered::interaction ( unsigned int  select_one,
unsigned int  select_two 
) const

Interaction matrix corresponding to $ \mu_{ij} $ moment

Parameters
select_one: first index (i)
select_two: second index (j)
Returns
Interaction matrix corresponding to the moment

Definition at line 73 of file vpFeatureMomentCentered.cpp.

References vpException::badValue, vpMoment::getObject(), vpMomentObject::getOrder(), vpFeatureMoment::interaction_matrices, vpFeatureMoment::moment, and order.

Referenced by vpFeatureMomentArea::compute_interaction(), and vpFeatureMomentCInvariant::compute_interaction().

vpMatrix vpFeatureMoment::interaction ( unsigned int  select = FEATURE_ALL)
virtualinherited

Retrieves the interaction matrix. No computation is done.

Parameters
select: Feature selector.
Returns
The corresponding interaction matrix.

There is no rule about the format of the feature selector. It may be different for different features. For example, for vpFeatureMomentBasic or vpFeatureMomentCentered features, select may refer to the $ (i,j) $ couple in the $ j \times order + i $ format, but for vpFeatureMomentCInvariant the selector allows to select couples $ (i,j,k,l...) $ in the following format: 1 << i

  • 1 << j + 1 << k + 1 << l.

Implements vpBasicFeature.

Definition at line 199 of file vpFeatureMoment.cpp.

References vpBasicFeature::dim_s, vpBasicFeature::FEATURE_LINE, vpFeatureMoment::interaction_matrices, and vpMatrix::stack().

Referenced by compute_interaction().

void vpFeatureMoment::linkTo ( vpFeatureMomentDatabase featureMoments)
inherited

Links the feature to the feature's database. NB: The feature's database is different from the moment's database.

Parameters
featureMoments: database in which the moment features are stored.

Definition at line 244 of file vpFeatureMoment.cpp.

References vpFeatureMoment::_name, vpFeatureMoment::featureMomentsDataBase, vpException::memoryAllocationError, and vpFeatureMoment::name().

Referenced by vpFeatureMomentCommon::vpFeatureMomentCommon().

const char* vpFeatureMomentCentered::momentName ( ) const
inlinevirtual

associated moment name

Implements vpFeatureMoment.

Definition at line 113 of file vpFeatureMomentCentered.h.

const char* vpFeatureMomentCentered::name ( ) const
inlinevirtual

feature name

Implements vpFeatureMoment.

Definition at line 117 of file vpFeatureMomentCentered.h.

References vpFeatureMoment::operator<<.

virtual double vpBasicFeature::operator[] ( unsigned int  i) const
inlinevirtualinherited

Return element i in the state vector (usage : x = s[i] )

Definition at line 130 of file vpBasicFeature.h.

void vpFeatureMoment::print ( unsigned int  select = FEATURE_ALL) const
virtualinherited

Outputs the content of the feature: it's corresponding selected moments.

Implements vpBasicFeature.

Definition at line 99 of file vpFeatureMoment.cpp.

References vpBasicFeature::dim_s, vpBasicFeature::FEATURE_LINE, and vpBasicFeature::s.

void vpFeatureMoment::printDependencies ( std::ostream &  os) const
virtualinherited

Interface function to display the moments and other interaction matrices on which a particular vpFeatureMoment is dependent upon Not made pure to maintain compatibility Recommended : Types inheriting from vpFeatureMoment should implement this function

Definition at line 281 of file vpFeatureMoment.cpp.

static unsigned int vpBasicFeature::selectAll ( )
inlinestaticinherited

Select all the features.

Definition at line 142 of file vpBasicFeature.h.

void vpBasicFeature::setDeallocate ( vpBasicFeatureDeallocatorType  d)
inlineinherited

Definition at line 137 of file vpBasicFeature.h.

Referenced by vpServo::addFeature().

void vpBasicFeature::setFlags ( )
inherited

Set feature flags to true to prevent warning when re-computing the interaction matrix without having updated the feature.

Definition at line 141 of file vpBasicFeature.cpp.

References vpBasicFeature::flags, and vpBasicFeature::nbParameters.

void vpFeatureMoment::update ( double  A_,
double  B_,
double  C_ 
)
inherited

Updates the interaction matrices with the image plane the camera is facing. The plane must be in the format: $ \frac{1}{Z}=Ax+By+C $ . The moment primitives MUST be updated before calling this function.

This method also computes the interaction matrix. Therefore, you must call vpFeatureMoment::update before calling vpFeatureMoment::interaction.

Attention
The behaviour of this method is not the same as vpMoment::update which only acknowledges the new object. This method also computes the interaction matrices.
Parameters
A_: A coefficient of the plane.
B_: B coefficient of the plane.
C_: C coefficient of the plane.
Examples:
mbot-apriltag-ibvs.cpp, and servoBebop2.cpp.

Definition at line 153 of file vpFeatureMoment.cpp.

References vpFeatureMoment::A, vpFeatureMoment::B, vpFeatureMoment::C, vpFeatureMoment::compute_interaction(), vpBasicFeature::dim_s, vpBasicFeature::flags, vpMomentDatabase::get(), vpMoment::get(), vpFeatureMoment::moment, vpFeatureMoment::momentName(), vpFeatureMoment::moments, vpBasicFeature::nbParameters, vpException::notInitialized, vpColVector::resize(), and vpBasicFeature::s.

Referenced by vpFeatureMomentCommon::updateAll().

Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  os,
const vpFeatureMomentCentered mu 
)
friend

Print all the interaction matrices of visual features

Definition at line 328 of file vpFeatureMomentCentered.cpp.

Member Data Documentation

char vpFeatureMoment::_name[255]
protectedinherited

Definition at line 171 of file vpFeatureMoment.h.

Referenced by vpFeatureMoment::linkTo().

const unsigned int vpBasicFeature::FEATURE_LINE
staticinherited
Initial value:
= {
(unsigned int)(1 << 0), (unsigned int)(1 << 1), (unsigned int)(1 << 2), (unsigned int)(1 << 3),
(unsigned int)(1 << 4), (unsigned int)(1 << 5), (unsigned int)(1 << 6), (unsigned int)(1 << 7),
(unsigned int)(1 << 8), (unsigned int)(1 << 9), (unsigned int)(1 << 10), (unsigned int)(1 << 11),
(unsigned int)(1 << 12), (unsigned int)(1 << 13), (unsigned int)(1 << 14), (unsigned int)(1 << 15),
(unsigned int)(1 << 16), (unsigned int)(1 << 17), (unsigned int)(1 << 18), (unsigned int)(1 << 19),
(unsigned int)(1 << 20), (unsigned int)(1 << 21), (unsigned int)(1 << 22), (unsigned int)(1 << 23),
(unsigned int)(1 << 24), (unsigned int)(1 << 25), (unsigned int)(1 << 26), (unsigned int)(1 << 27),
(unsigned int)(1 << 28), (unsigned int)(1 << 29), (unsigned int)(1 << 30), (unsigned int)(1 << 31)}

Definition at line 80 of file vpBasicFeature.h.

Referenced by vpBasicFeature::error(), vpGenericFeature::error(), vpBasicFeature::get_s(), vpBasicFeature::getDimension(), vpFeatureMoment::getDimension(), vpGenericFeature::interaction(), vpFeatureMoment::interaction(), vpGenericFeature::print(), vpFeatureMoment::print(), vpFeatureEllipse::select_n02(), vpFeatureEllipse::select_n11(), vpFeatureEllipse::select_n20(), vpFeatureVanishingPoint::selectAlpha(), vpFeatureSegment::selectAlpha(), vpFeatureVanishingPoint::selectAtanOneOverRho(), vpFeatureSegment::selectL(), vpFeatureEllipse::selectMu02(), vpFeatureEllipse::selectMu11(), vpFeatureEllipse::selectMu20(), vpFeatureVanishingPoint::selectOneOverRho(), vpFeatureLine::selectRho(), vpFeaturePointPolar::selectRho(), vpFeatureLine::selectTheta(), vpFeaturePointPolar::selectTheta(), vpFeatureThetaU::selectTUx(), vpFeatureThetaU::selectTUy(), vpFeatureThetaU::selectTUz(), vpFeatureTranslation::selectTx(), vpFeatureTranslation::selectTy(), vpFeatureTranslation::selectTz(), vpFeatureVanishingPoint::selectX(), vpFeatureEllipse::selectX(), vpFeaturePoint::selectX(), vpFeaturePoint3D::selectX(), vpFeatureSegment::selectXc(), vpFeatureVanishingPoint::selectY(), vpFeatureEllipse::selectY(), vpFeaturePoint::selectY(), vpFeaturePoint3D::selectY(), vpFeatureSegment::selectYc(), and vpFeaturePoint3D::selectZ().

bool* vpBasicFeature::flags
protectedinherited

Ensure that all the parameters needed to compute the iteraction matrix are set.

Definition at line 98 of file vpBasicFeature.h.

Referenced by vpFeatureEllipse::buildFrom(), vpFeatureDepth::buildFrom(), vpFeaturePoint::buildFrom(), vpFeatureLine::buildFrom(), vpFeaturePoint3D::buildFrom(), vpFeatureThetaU::buildFrom(), vpFeaturePointPolar::buildFrom(), vpFeatureTranslation::buildFrom(), vpFeatureMoment::duplicate(), vpFeatureVanishingPoint::init(), vpFeatureLuminance::init(), vpFeatureEllipse::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), vpFeaturePoint::init(), vpFeatureMoment::init(), vpFeatureLine::init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), vpFeatureTranslation::init(), vpFeatureVanishingPoint::interaction(), vpFeatureEllipse::interaction(), vpFeatureSegment::interaction(), vpFeatureDepth::interaction(), vpFeaturePoint::interaction(), vpFeatureLine::interaction(), vpFeaturePoint3D::interaction(), vpFeatureThetaU::interaction(), vpFeaturePointPolar::interaction(), vpFeatureTranslation::interaction(), vpBasicFeature::operator=(), vpBasicFeature::resetFlags(), vpFeaturePointPolar::set_rho(), vpFeaturePointPolar::set_rhoThetaZ(), vpFeaturePointPolar::set_theta(), vpFeatureThetaU::set_TUx(), vpFeatureThetaU::set_TUy(), vpFeatureThetaU::set_TUz(), vpFeatureVanishingPoint::set_x(), vpFeatureEllipse::set_x(), vpFeatureDepth::set_x(), vpFeaturePoint::set_x(), vpFeaturePoint3D::set_X(), vpFeatureEllipse::set_xy(), vpFeaturePoint::set_xyZ(), vpFeaturePoint3D::set_XYZ(), vpFeatureDepth::set_xyZLogZoverZstar(), vpFeatureVanishingPoint::set_y(), vpFeatureEllipse::set_y(), vpFeatureDepth::set_y(), vpFeaturePoint::set_y(), vpFeaturePoint3D::set_Y(), vpFeatureLuminance::set_Z(), vpFeatureDepth::set_Z(), vpFeaturePoint::set_Z(), vpFeaturePoint3D::set_Z(), vpFeaturePointPolar::set_Z(), vpFeatureEllipse::setABC(), vpFeatureLine::setABCD(), vpFeatureVanishingPoint::setAlpha(), vpFeatureVanishingPoint::setAtanOneOverRho(), vpBasicFeature::setFlags(), vpFeatureEllipse::setMoments(), vpFeatureVanishingPoint::setOneOverRho(), vpFeatureLine::setRhoTheta(), vpFeatureMoment::update(), vpFeatureLuminance::vpFeatureLuminance(), and vpBasicFeature::~vpBasicFeature().

unsigned int vpFeatureMomentCentered::order
protected

Definition at line 82 of file vpFeatureMomentCentered.h.

Referenced by compute_interaction(), and interaction().

vpColVector vpBasicFeature::s
protectedinherited

State of the visual feature.

Definition at line 92 of file vpBasicFeature.h.

Referenced by vpFeatureEllipse::buildFrom(), vpFeatureLuminance::buildFrom(), vpFeatureDepth::buildFrom(), vpFeaturePoint::buildFrom(), vpFeatureLine::buildFrom(), vpFeaturePoint3D::buildFrom(), vpFeatureThetaU::buildFrom(), vpFeaturePointPolar::buildFrom(), vpFeatureTranslation::buildFrom(), vpFeatureEllipse::display(), vpFeatureMoment::duplicate(), vpFeatureEllipse::error(), vpFeatureVanishingPoint::error(), vpFeatureLuminance::error(), vpBasicFeature::error(), vpFeatureMomentAlpha::error(), vpFeatureDepth::error(), vpGenericFeature::error(), vpFeaturePoint::error(), vpFeatureLine::error(), vpFeaturePoint3D::error(), vpFeatureThetaU::error(), vpFeaturePointPolar::error(), vpFeatureTranslation::error(), vpFeatureDepth::get_LogZoverZstar(), vpFeaturePointPolar::get_rho(), vpBasicFeature::get_s(), vpGenericFeature::get_s(), vpFeaturePointPolar::get_theta(), vpFeatureThetaU::get_TUx(), vpFeatureThetaU::get_TUy(), vpFeatureThetaU::get_TUz(), vpFeatureTranslation::get_Tx(), vpFeatureTranslation::get_Ty(), vpFeatureTranslation::get_Tz(), vpFeatureVanishingPoint::get_x(), vpFeaturePoint::get_x(), vpFeaturePoint3D::get_X(), vpFeatureVanishingPoint::get_y(), vpFeaturePoint::get_y(), vpFeaturePoint3D::get_Y(), vpFeaturePoint3D::get_Z(), vpFeatureVanishingPoint::getAlpha(), vpFeatureVanishingPoint::getAtanOneOverRho(), vpBasicFeature::getDimension(), vpFeatureVanishingPoint::getOneOverRho(), vpFeatureVanishingPoint::init(), vpFeatureLuminance::init(), vpFeatureEllipse::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), vpGenericFeature::init(), vpFeaturePoint::init(), vpFeatureMoment::init(), vpFeatureLine::init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), vpFeatureTranslation::init(), vpFeatureEllipse::interaction(), vpFeatureLine::interaction(), vpFeatureThetaU::interaction(), vpFeatureTranslation::interaction(), vpBasicFeature::operator=(), vpFeatureEllipse::print(), vpFeatureSegment::print(), vpGenericFeature::print(), vpFeatureMoment::print(), vpFeatureLine::print(), vpFeatureThetaU::print(), vpFeatureTranslation::print(), vpFeatureDepth::set_LogZoverZstar(), vpFeaturePointPolar::set_rho(), vpGenericFeature::set_s(), vpFeaturePointPolar::set_theta(), vpFeatureThetaU::set_TUx(), vpFeatureThetaU::set_TUy(), vpFeatureThetaU::set_TUz(), vpFeatureTranslation::set_Tx(), vpFeatureTranslation::set_Ty(), vpFeatureTranslation::set_Tz(), vpFeatureVanishingPoint::set_x(), vpFeatureEllipse::set_x(), vpFeaturePoint::set_x(), vpFeaturePoint3D::set_X(), vpFeatureEllipse::set_xy(), vpFeatureVanishingPoint::set_y(), vpFeatureEllipse::set_y(), vpFeaturePoint::set_y(), vpFeaturePoint3D::set_Y(), vpFeaturePoint3D::set_Z(), vpFeatureVanishingPoint::setAlpha(), vpFeatureVanishingPoint::setAtanOneOverRho(), vpFeatureEllipse::setMoments(), vpFeatureVanishingPoint::setOneOverRho(), vpFeatureLine::setRhoTheta(), vpFeatureMoment::update(), and vpGenericFeature::vpGenericFeature().