Visual Servoing Platform  version 3.6.1 under development (2024-03-28)
vpFeatureMomentBasic Class Reference

#include <visp3/visual_features/vpFeatureMomentBasic.h>

+ Inheritance diagram for vpFeatureMomentBasic:

Public Types

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

Public Member Functions

 vpFeatureMomentBasic (vpMomentDatabase &moments, double A, double B, double C, vpFeatureMomentDatabase *featureMoments=nullptr)
 
void compute_interaction () vp_override
 
vpMatrix interaction (unsigned int select_one, unsigned int select_two) const
 
const std::string momentName () const vp_override
 
const std::string name () const vp_override
 
Inherited functionalities from vpFeatureMoment
vpBasicFeatureduplicate () const vp_override
 
void display (const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const vp_override
 
void display (const vpCameraParameters &cam, const vpImage< vpRGBa > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const vp_override
 
int getDimension (unsigned int select=FEATURE_ALL) const
 
void init (void) vp_override
 
vpMatrix interaction (unsigned int select=FEATURE_ALL) vp_override
 
void linkTo (vpFeatureMomentDatabase &featureMoments)
 
void print (unsigned int select=FEATURE_ALL) const vp_override
 
virtual void printDependencies (std::ostream &os) const
 
void update (double A, double B, double C)
 

Static Public Attributes

static const unsigned int FEATURE_LINE [32]
 

Protected Member Functions

const vpMomentgetMoment () const
 

Protected Attributes

unsigned int order
 
const vpMomentmoment
 
vpMomentDatabasemoments
 
vpFeatureMomentDatabasefeatureMomentsDataBase
 
std::vector< vpMatrixinteraction_matrices
 
double A
 
double B
 
double C
 
std::string m_name
 
vpColVector s
 
unsigned int dim_s
 
bool * flags
 
unsigned int nbParameters
 

Inherited functionalities from vpBasicFeature

vpBasicFeatureDeallocatorType deallocate
 
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 ()
 
void resetFlags ()
 
static unsigned int selectAll ()
 

Detailed Description

Functionality computation for basic moment feature. Computes the interaction matrix associated with vpMomentBasic.

The interaction matrix for the basic moment feature is defined in [45], equation (13). This vpFeatureMoment, as well as it's corresponding moment primitive is double-indexed. The interaction matrix $ L_{m_{ij}} $ is obtained by calling vpFeatureMomentBasic::interaction (i,j) and is associated to $ m_{ij} $ obtained by vpMomentBasic::get (i,j). vpFeatureMomentBasic 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 $.

You can see an example of vpFeatureMomentBasic by looking at the documentation of the vpFeatureMoment class.

This feature depends on:

Definition at line 76 of file vpFeatureMomentBasic.h.

Member Enumeration Documentation

◆ vpBasicFeatureDeallocatorType

Indicates who should deallocate the feature.

Enumerator
user 
vpServo 

Definition at line 86 of file vpBasicFeature.h.

◆ vpBasicFeatureSelect

Enumerator
FEATURE_ALL 

Definition at line 81 of file vpBasicFeature.h.

Constructor & Destructor Documentation

◆ vpFeatureMomentBasic()

vpFeatureMomentBasic::vpFeatureMomentBasic ( vpMomentDatabase data_base,
double  A_,
double  B_,
double  C_,
vpFeatureMomentDatabase featureMoments = nullptr 
)

Default constructor.

Parameters
data_base: 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 47 of file vpFeatureMomentBasic.cpp.

Member Function Documentation

◆ compute_interaction()

void vpFeatureMomentBasic::compute_interaction ( void  )
virtual

Computes interaction matrix for basic moment. Called internally. The moment primitives must be computed before calling this.

Reimplemented from vpFeatureMoment.

Definition at line 56 of file vpFeatureMomentBasic.cpp.

References vpFeatureMoment::A, vpFeatureMoment::B, vpFeatureMoment::C, vpMomentObject::DISCRETE, vpMomentObject::get(), vpMoment::getObject(), vpMomentObject::getOrder(), vpMomentObject::getType(), vpFeatureMoment::interaction_matrices, vpFeatureMoment::moment, and order.

◆ dimension_s()

unsigned int vpBasicFeature::dimension_s ( )
inlineinherited

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

Definition at line 108 of file vpBasicFeature.h.

◆ display() [1/2]

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

◆ display() [2/2]

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

◆ duplicate()

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 access 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 216 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.

◆ error()

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

◆ get_s()

◆ getDeallocate()

vpBasicFeatureDeallocatorType vpBasicFeature::getDeallocate ( )
inlineinherited

Definition at line 121 of file vpBasicFeature.h.

◆ getDimension()

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

Feature's dimension according to selection.

Definition at line 80 of file vpFeatureMoment.cpp.

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

◆ getMoment()

const vpMoment& vpFeatureMoment::getMoment ( ) const
inlineprotectedinherited

Definition at line 160 of file vpFeatureMoment.h.

◆ init()

void vpFeatureMoment::init ( void  )
virtualinherited

Initialize common parameters for moment features.

Implements vpBasicFeature.

Definition at line 51 of file vpFeatureMoment.cpp.

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

◆ interaction() [1/2]

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

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

Referenced by vpFeatureMomentCentered::compute_interaction().

◆ interaction() [2/2]

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

Interaction matrix corresponding to $ m_{ij} $ moment.

Parameters
select_one: first index (i).
select_two: second index (j).
Returns
Interaction matrix $ L_{m_{ij}} $ corresponding to the moment.

Definition at line 153 of file vpFeatureMomentBasic.cpp.

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

Referenced by vpFeatureMomentCInvariant::compute_interaction(), and vpFeatureMomentCentered::compute_Lmu_pq().

◆ linkTo()

void vpFeatureMoment::linkTo ( vpFeatureMomentDatabase featureMoments)
inherited

Links the feature to the feature's database.

Note
The feature's database is different from the moment's database.
Parameters
featureMoments: database in which the moment features are stored.

Definition at line 240 of file vpFeatureMoment.cpp.

References vpFeatureMoment::featureMomentsDataBase, vpFeatureMoment::m_name, and vpFeatureMoment::name().

Referenced by vpFeatureMomentCommon::vpFeatureMomentCommon().

◆ momentName()

const std::string vpFeatureMomentBasic::momentName ( ) const
inlinevirtual

Associated moment name.

Implements vpFeatureMoment.

Definition at line 100 of file vpFeatureMomentBasic.h.

◆ name()

const std::string vpFeatureMomentBasic::name ( ) const
inlinevirtual

Feature name.

Implements vpFeatureMoment.

Definition at line 108 of file vpFeatureMomentBasic.h.

◆ operator[]()

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

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

Definition at line 128 of file vpBasicFeature.h.

◆ print()

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

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

◆ printDependencies()

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

◆ resetFlags()

◆ selectAll()

static unsigned int vpBasicFeature::selectAll ( )
inlinestaticinherited

Select all the features.

Definition at line 140 of file vpBasicFeature.h.

◆ setDeallocate()

void vpBasicFeature::setDeallocate ( vpBasicFeatureDeallocatorType  d)
inlineinherited

Definition at line 135 of file vpBasicFeature.h.

Referenced by vpServo::addFeature().

◆ setFlags()

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 139 of file vpBasicFeature.cpp.

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

◆ update()

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.

Definition at line 147 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

◆ A

◆ B

◆ C

◆ deallocate

◆ dim_s

◆ FEATURE_LINE

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 79 of file vpBasicFeature.h.

Referenced by vpBasicFeature::error(), vpGenericFeature::error(), vpBasicFeature::get_s(), vpBasicFeature::getDimension(), vpFeatureMoment::getDimension(), vpFeatureMoment::interaction(), vpGenericFeature::interaction(), vpFeatureMoment::print(), vpGenericFeature::print(), vpFeatureEllipse::select_n02(), vpFeatureEllipse::select_n11(), vpFeatureEllipse::select_n20(), vpFeatureSegment::selectAlpha(), vpFeatureVanishingPoint::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(), vpFeatureEllipse::selectX(), vpFeaturePoint::selectX(), vpFeaturePoint3D::selectX(), vpFeatureVanishingPoint::selectX(), vpFeatureSegment::selectXc(), vpFeatureEllipse::selectY(), vpFeaturePoint::selectY(), vpFeaturePoint3D::selectY(), vpFeatureVanishingPoint::selectY(), vpFeatureSegment::selectYc(), and vpFeaturePoint3D::selectZ().

◆ featureMomentsDataBase

◆ flags

bool* vpBasicFeature::flags
protectedinherited

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

Definition at line 96 of file vpBasicFeature.h.

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

◆ interaction_matrices

◆ m_name

std::string vpFeatureMoment::m_name
protectedinherited

Definition at line 168 of file vpFeatureMoment.h.

Referenced by vpFeatureMoment::linkTo().

◆ moment

◆ moments

◆ nbParameters

◆ order

unsigned int vpFeatureMomentBasic::order
protected

Definition at line 79 of file vpFeatureMomentBasic.h.

Referenced by compute_interaction(), and interaction().

◆ s

vpColVector vpBasicFeature::s
protectedinherited

State of the visual feature.

Definition at line 90 of file vpBasicFeature.h.

Referenced by vpFeatureTranslation::buildFrom(), vpFeaturePoint3D::buildFrom(), vpFeatureLine::buildFrom(), vpFeaturePointPolar::buildFrom(), vpFeatureEllipse::buildFrom(), vpFeaturePoint::buildFrom(), vpFeatureDepth::buildFrom(), vpFeatureLuminance::buildFrom(), vpFeatureThetaU::buildFrom(), vpFeatureEllipse::display(), vpFeatureMoment::duplicate(), vpFeatureVanishingPoint::error(), vpBasicFeature::error(), vpFeatureDepth::error(), vpFeatureEllipse::error(), vpFeatureLine::error(), vpFeatureMomentAlpha::error(), vpFeaturePoint::error(), vpFeaturePoint3D::error(), vpFeaturePointPolar::error(), vpFeatureThetaU::error(), vpFeatureTranslation::error(), vpGenericFeature::error(), vpFeatureLuminance::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(), vpFeaturePoint::get_x(), vpFeaturePoint3D::get_X(), vpFeatureVanishingPoint::get_x(), vpFeaturePoint::get_y(), vpFeaturePoint3D::get_Y(), vpFeatureVanishingPoint::get_y(), vpFeaturePoint3D::get_Z(), vpFeatureVanishingPoint::getAlpha(), vpFeatureVanishingPoint::getAtanOneOverRho(), vpBasicFeature::getDimension(), vpFeatureVanishingPoint::getOneOverRho(), vpFeatureDepth::init(), vpFeatureEllipse::init(), vpFeatureLine::init(), vpFeaturePoint::init(), vpFeaturePoint3D::init(), vpFeaturePointPolar::init(), vpFeatureSegment::init(), vpFeatureThetaU::init(), vpFeatureTranslation::init(), vpFeatureVanishingPoint::init(), vpGenericFeature::init(), vpFeatureLuminance::init(), vpFeatureMoment::init(), vpFeatureEllipse::interaction(), vpFeatureLine::interaction(), vpFeatureThetaU::interaction(), vpFeatureTranslation::interaction(), vpBasicFeature::operator=(), vpFeatureEllipse::print(), vpFeatureLine::print(), vpFeatureMoment::print(), vpFeatureSegment::print(), vpFeatureThetaU::print(), vpFeatureTranslation::print(), vpGenericFeature::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(), vpFeaturePoint::set_x(), vpFeaturePoint3D::set_X(), vpFeatureVanishingPoint::set_x(), vpFeatureEllipse::set_xy(), vpFeatureEllipse::set_y(), vpFeaturePoint::set_y(), vpFeaturePoint3D::set_Y(), vpFeatureVanishingPoint::set_y(), vpFeaturePoint3D::set_Z(), vpFeatureVanishingPoint::setAlpha(), vpFeatureVanishingPoint::setAtanOneOverRho(), vpFeatureEllipse::setMoments(), vpFeatureVanishingPoint::setOneOverRho(), vpFeatureLine::setRhoTheta(), vpFeatureMoment::update(), and vpGenericFeature::vpGenericFeature().