ViSP  2.9.0

#include <vpFeatureMomentCInvariant.h>

+ Inheritance diagram for vpFeatureMomentCInvariant:

Public Types

enum  vpBasicFeatureDeallocatorType { user, vpServo }
 

Public Member Functions

 vpFeatureMomentCInvariant (vpMomentDatabase &data_base, double A_, double B_, double C_, vpFeatureMomentDatabase *featureMoments=NULL)
 
void compute_interaction ()
 
const char * momentName () const
 
const char * name () const
 
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 (const unsigned int select=FEATURE_ALL)
 
void linkTo (vpFeatureMomentDatabase &featureMoments)
 
void print (const unsigned int select=FEATURE_ALL) const
 
void update (double A, double B, double C)
 
unsigned int dimension_s ()
 
virtual double operator[] (const unsigned int i) const
 
vpColVector get_s (unsigned int select=FEATURE_ALL) const
 
virtual vpColVector error (const vpBasicFeature &s_star, const unsigned int select=FEATURE_ALL)
 
void setFlags ()
 
void setDeallocate (vpBasicFeatureDeallocatorType d)
 
vpBasicFeatureDeallocatorType getDeallocate ()
 

Static Public Member Functions

static unsigned int selectC1 ()
 
static unsigned int selectC2 ()
 
static unsigned int selectC3 ()
 
static unsigned int selectC4 ()
 
static unsigned int selectC5 ()
 
static unsigned int selectC6 ()
 
static unsigned int selectC7 ()
 
static unsigned int selectC8 ()
 
static unsigned int selectC9 ()
 
static unsigned int selectC10 ()
 
static unsigned int selectSx ()
 
static unsigned int selectSy ()
 
static unsigned int selectPx ()
 
static unsigned int selectPy ()
 
static unsigned int selectAll ()
 

Static Public Attributes

static const unsigned int FEATURE_LINE [32]
 
static const unsigned int FEATURE_ALL = 0xffff
 

Protected Member Functions

const vpMomentgetMoment () const
 
void resetFlags ()
 

Protected Attributes

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
 

Detailed Description

Functionality computation for 2D rotation/translation/scale non-symmetric invariant moment feature. Computes the interaction matrix associated with vpMomentCInvariant.

The interaction matrix for the moment feature can be deduced from [23], equations (9). To do so, one must derive them and obtain a combination of interaction matrices by using (1). It allows to compute the interaction matrix for $ c_i, i \in [1..10] $.

These interaction matrices may be selected afterwards by calling vpFeatureMomentCInvariant::interaction(). The selection by the vpFeatureMomentCInvariant::selectCi method for $ L_{c_i} $. For example, to select $ L_{c_1} $ you should input vpFeatureMomentCInvariant::selectC1() into ViSP's selector. Special matrices for features $ S_x $ and $ S_y $ are selected by vpFeatureMomentCInvariant::selectSx() and vpFeatureMomentCInvariant::selectSy() respectively. Special matrices for features $ P_x $ and $ P_y $ are selected by vpFeatureMomentCInvariant::selectPx() and vpFeatureMomentCInvariant::selectPy() respectively.

These features are often used in moment-based visual servoing to control the two out-of-plane rotations.

Be careful about the nature of your object when selecting the right features. Use $ L_{S_{x}} $ and $ L_{S_{y}} $ when you're dealing with a symmetric object all other features otherwise.

Minimum vpMomentObject order needed to compute this feature: 6. This is the highest ordrer required by classic features.

This feature depends on:

An example of how to use vpFeatureMomentCInvariant in a complete visual servoing example is given in vpFeatureMomentCommon.

Definition at line 200 of file vpFeatureMomentCInvariant.h.

Member Enumeration Documentation

Indicates who should deallocate the feature.

Enumerator
user 
vpServo 

Definition at line 154 of file vpBasicFeature.h.

Constructor & Destructor Documentation

vpFeatureMomentCInvariant::vpFeatureMomentCInvariant ( vpMomentDatabase data_base,
double  A_,
double  B_,
double  C_,
vpFeatureMomentDatabase featureMoments = NULL 
)
inline

Initializes the feature with information about the database of moment primitives, the object plane and feature database.

Parameters
data_base: Moment database. The database of moment primitives (first parameter) is mandatory. It is used to access different moment values later used to compute the final matrix.
A_: Plane coefficient in a $ A \times x+B \times y + C = \frac{1}{Z} $ plane.
B_: Plane coefficient in a $ A \times x+B \times y + C = \frac{1}{Z} $ plane.
C_: Plane coefficient in a $ A \times x+B \times y + C = \frac{1}{Z} $ plane.
featureMoments: Feature database.

Definition at line 211 of file vpFeatureMomentCInvariant.h.

Member Function Documentation

unsigned int vpBasicFeature::dimension_s ( )
inlineinherited

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

Definition at line 102 of file vpBasicFeature.h.

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 115 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 213 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.

vpColVector vpBasicFeature::error ( const vpBasicFeature s_star,
const unsigned int  select = FEATURE_ALL 
)
virtualinherited
vpBasicFeatureDeallocatorType vpBasicFeature::getDeallocate ( )
inlineinherited

Definition at line 164 of file vpBasicFeature.h.

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

Feature's dimension according to selection.

Definition at line 88 of file vpFeatureMoment.cpp.

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

const vpMoment& vpFeatureMoment::getMoment ( ) const
inlineprotectedinherited

Definition at line 149 of file vpFeatureMoment.h.

void vpFeatureMoment::init ( void  )
virtualinherited

Initialize common parameters for moment features.

Implements vpBasicFeature.

Definition at line 60 of file vpFeatureMoment.cpp.

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

vpMatrix vpFeatureMoment::interaction ( const 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 193 of file vpFeatureMoment.cpp.

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

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 236 of file vpFeatureMoment.cpp.

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

Referenced by vpFeatureMomentCommon::vpFeatureMomentCommon().

const char* vpFeatureMomentCInvariant::momentName ( ) const
inlinevirtual

associated moment name

Implements vpFeatureMoment.

Definition at line 217 of file vpFeatureMomentCInvariant.h.

const char* vpFeatureMomentCInvariant::name ( ) const
inlinevirtual

feature name

Implements vpFeatureMoment.

Definition at line 221 of file vpFeatureMomentCInvariant.h.

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

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

Definition at line 113 of file vpBasicFeature.h.

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

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

Implements vpBasicFeature.

Definition at line 102 of file vpFeatureMoment.cpp.

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

static unsigned int vpBasicFeature::selectAll ( )
inlinestaticinherited

Select all the features.

Definition at line 116 of file vpBasicFeature.h.

static unsigned int vpFeatureMomentCInvariant::selectC1 ( )
inlinestatic

Shortcut selector for $C_1$.

Definition at line 226 of file vpFeatureMomentCInvariant.h.

static unsigned int vpFeatureMomentCInvariant::selectC10 ( )
inlinestatic

Shortcut selector for $C_{10}$.

Definition at line 262 of file vpFeatureMomentCInvariant.h.

static unsigned int vpFeatureMomentCInvariant::selectC2 ( )
inlinestatic

Shortcut selector for $C_2$.

Definition at line 230 of file vpFeatureMomentCInvariant.h.

static unsigned int vpFeatureMomentCInvariant::selectC3 ( )
inlinestatic

Shortcut selector for $C_3$.

Definition at line 234 of file vpFeatureMomentCInvariant.h.

static unsigned int vpFeatureMomentCInvariant::selectC4 ( )
inlinestatic

Shortcut selector for $C_4$.

Examples:
manServoMomentsSimple.cpp.

Definition at line 238 of file vpFeatureMomentCInvariant.h.

static unsigned int vpFeatureMomentCInvariant::selectC5 ( )
inlinestatic

Shortcut selector for $C_5$.

Definition at line 242 of file vpFeatureMomentCInvariant.h.

static unsigned int vpFeatureMomentCInvariant::selectC6 ( )
inlinestatic

Shortcut selector for $C_6$.

Examples:
manServoMomentsSimple.cpp.

Definition at line 246 of file vpFeatureMomentCInvariant.h.

static unsigned int vpFeatureMomentCInvariant::selectC7 ( )
inlinestatic

Shortcut selector for $C_7$.

Definition at line 250 of file vpFeatureMomentCInvariant.h.

static unsigned int vpFeatureMomentCInvariant::selectC8 ( )
inlinestatic

Shortcut selector for $C_8$.

Definition at line 254 of file vpFeatureMomentCInvariant.h.

static unsigned int vpFeatureMomentCInvariant::selectC9 ( )
inlinestatic

Shortcut selector for $C_9$.

Definition at line 258 of file vpFeatureMomentCInvariant.h.

static unsigned int vpFeatureMomentCInvariant::selectPx ( )
inlinestatic

Shortcut selector for $P_x$.

Definition at line 274 of file vpFeatureMomentCInvariant.h.

static unsigned int vpFeatureMomentCInvariant::selectPy ( )
inlinestatic

Shortcut selector for $P_y$.

Definition at line 278 of file vpFeatureMomentCInvariant.h.

static unsigned int vpFeatureMomentCInvariant::selectSx ( )
inlinestatic

Shortcut selector for $S_x$.

Definition at line 266 of file vpFeatureMomentCInvariant.h.

static unsigned int vpFeatureMomentCInvariant::selectSy ( )
inlinestatic

Shortcut selector for $S_y$.

Definition at line 270 of file vpFeatureMomentCInvariant.h.

void vpBasicFeature::setDeallocate ( vpBasicFeatureDeallocatorType  d)
inlineinherited

Definition at line 163 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 151 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.

Definition at line 149 of file vpFeatureMoment.cpp.

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

Referenced by vpFeatureMomentCommon::updateAll().

Member Data Documentation

char vpFeatureMoment::_name[255]
protectedinherited

Definition at line 157 of file vpFeatureMoment.h.

Referenced by vpFeatureMoment::linkTo().

const unsigned int vpBasicFeature::FEATURE_ALL = 0xffff
staticinherited
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 85 of file vpBasicFeature.h.

Referenced by vpBasicFeature::error(), vpGenericFeature::error(), vpBasicFeature::get_s(), vpBasicFeature::getDimension(), vpFeatureMoment::getDimension(), vpGenericFeature::interaction(), vpFeatureMoment::interaction(), vpGenericFeature::print(), and vpFeatureMoment::print().

vpFeatureMomentDatabase* vpFeatureMoment::featureMomentsDataBase
protectedinherited
bool* vpBasicFeature::flags
protectedinherited

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

Definition at line 96 of file vpBasicFeature.h.

Referenced by vpFeatureEllipse::buildFrom(), vpFeatureVanishingPoint::buildFrom(), vpFeatureDepth::buildFrom(), vpFeaturePoint::buildFrom(), vpFeatureLine::buildFrom(), vpFeaturePoint3D::buildFrom(), vpFeatureThetaU::buildFrom(), vpFeaturePointPolar::buildFrom(), vpFeatureTranslation::buildFrom(), vpFeatureMoment::duplicate(), vpFeatureEllipse::init(), vpFeatureVanishingPoint::init(), vpFeatureLuminance::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), vpFeatureMoment::init(), vpFeaturePoint::init(), vpFeatureLine::init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), vpFeatureTranslation::init(), vpFeatureEllipse::interaction(), vpFeatureVanishingPoint::interaction(), vpFeatureSegment::interaction(), vpFeatureDepth::interaction(), vpFeaturePoint::interaction(), vpFeatureLine::interaction(), vpFeaturePoint3D::interaction(), vpFeaturePointPolar::interaction(), vpFeatureThetaU::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(), vpFeatureEllipse::set_x(), vpFeatureVanishingPoint::set_x(), vpFeatureDepth::set_x(), vpFeaturePoint::set_x(), vpFeaturePoint3D::set_X(), vpFeatureEllipse::set_xy(), vpFeaturePoint::set_xyZ(), vpFeaturePoint3D::set_XYZ(), vpFeatureDepth::set_xyZLogZoverZstar(), vpFeatureEllipse::set_y(), vpFeatureVanishingPoint::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(), vpBasicFeature::setFlags(), vpFeatureEllipse::setMu(), vpFeatureLine::setRhoTheta(), vpFeatureMoment::update(), vpFeatureLuminance::vpFeatureLuminance(), vpFeatureDepth::~vpFeatureDepth(), vpFeatureEllipse::~vpFeatureEllipse(), vpFeatureLine::~vpFeatureLine(), vpFeatureLuminance::~vpFeatureLuminance(), vpFeatureMoment::~vpFeatureMoment(), vpFeaturePoint::~vpFeaturePoint(), vpFeaturePoint3D::~vpFeaturePoint3D(), vpFeaturePointPolar::~vpFeaturePointPolar(), vpFeatureSegment::~vpFeatureSegment(), vpFeatureThetaU::~vpFeatureThetaU(), vpFeatureTranslation::~vpFeatureTranslation(), and vpFeatureVanishingPoint::~vpFeatureVanishingPoint().

vpColVector vpBasicFeature::s
protectedinherited

State of the visual feature.

Definition at line 91 of file vpBasicFeature.h.

Referenced by vpFeatureEllipse::buildFrom(), vpFeatureLuminance::buildFrom(), vpFeatureVanishingPoint::buildFrom(), vpFeatureDepth::buildFrom(), vpFeaturePoint::buildFrom(), vpFeatureLine::buildFrom(), vpFeaturePoint3D::buildFrom(), vpFeatureThetaU::buildFrom(), vpFeaturePointPolar::buildFrom(), vpFeatureTranslation::buildFrom(), vpFeatureEllipse::display(), vpFeatureMoment::duplicate(), vpBasicFeature::error(), vpFeatureEllipse::error(), vpFeatureVanishingPoint::error(), vpFeatureLuminance::error(), vpFeatureMomentAlpha::error(), vpGenericFeature::error(), vpFeatureDepth::error(), vpFeaturePoint::error(), vpFeatureLine::error(), vpFeaturePoint3D::error(), vpFeaturePointPolar::error(), vpFeatureThetaU::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(), vpBasicFeature::getDimension(), vpFeatureEllipse::init(), vpFeatureVanishingPoint::init(), vpFeatureLuminance::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), vpGenericFeature::init(), vpFeatureMoment::init(), vpFeaturePoint::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(), vpFeatureEllipse::set_x(), vpFeatureVanishingPoint::set_x(), vpFeaturePoint::set_x(), vpFeaturePoint3D::set_X(), vpFeatureEllipse::set_xy(), vpFeatureEllipse::set_y(), vpFeatureVanishingPoint::set_y(), vpFeaturePoint::set_y(), vpFeaturePoint3D::set_Y(), vpFeaturePoint3D::set_Z(), vpFeatureEllipse::setMu(), vpFeatureLine::setRhoTheta(), vpFeatureMoment::update(), and vpGenericFeature::vpGenericFeature().