Visual Servoing Platform  version 3.2.0
vpFeatureMomentAlpha Class Reference

#include <vpFeatureMomentAlpha.h>

+ Inheritance diagram for vpFeatureMomentAlpha:

Public Types

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

Public Member Functions

 vpFeatureMomentAlpha (vpMomentDatabase &data_base, double A_, double B_, double C_, vpFeatureMomentDatabase *featureMoments=NULL)
 
void compute_interaction ()
 
const char * momentName () const
 
const char * name () const
 
vpColVector error (const vpBasicFeature &s_star, const unsigned int select=FEATURE_ALL)
 
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 (const unsigned int select=FEATURE_ALL)
 
void linkTo (vpFeatureMomentDatabase &featureMoments)
 
void print (const unsigned int select=FEATURE_ALL) const
 
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

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
 

Inherited functionalities from vpBasicFeature

unsigned int dimension_s ()
 
vpColVector get_s (unsigned int select=FEATURE_ALL) const
 
vpBasicFeatureDeallocatorType getDeallocate ()
 
virtual double operator[] (const unsigned int i) const
 
void setDeallocate (vpBasicFeatureDeallocatorType d)
 
void setFlags ()
 
vpBasicFeatureDeallocatorType deallocate
 
void resetFlags ()
 
static unsigned int selectAll ()
 

Detailed Description

Functionality computation for in-plane rotation moment feature $ \alpha $: computes the interaction matrix associated with vpMomentAlpha.

This class computes the interaction matrix associated to $ \alpha = \frac{1}{2} arctan(\frac{2\mu_{11}}{\mu_{20}-\mu_{02}}) $ moment primitive.

The interaction matrix for the feature has the following form:

\[{ \left[ \begin {array}{c} {\frac {\mu_{{1,1}}{\it DA}\,A}{d}}+{\frac { \left( {\it DA}\,\mu_{{0,2}}+1/2\,d-1/2\,{{\it DA}}^{2} \right) B}{d} }\\ \noalign{\medskip}{\frac { \left( {\it DA}\,\mu_{{0,2}}-1/2\,d-1/2 \,{{\it DA}}^{2} \right) A}{d}}-{\frac {B\mu_{{1,1}}{\it DA}}{d}} \\ \noalign{\medskip}Bw_{{x}}-Aw_{{y}}\\ \noalign{\medskip}{\frac { \beta\, \left( \mu_{{1,2}} \left( \mu_{{2,0}}-\mu_{{0,2}} \right) +\mu _{{1,1}} \left( \mu_{{0,3}}-\mu_{{2,1}} \right) \right) +\gamma\,x_{{ g}} \left( \mu_{{0,2}} \left( \mu_{{2,0}}-\mu_{{0,2}} \right) -2\,{\mu _{{1,1}}}^{2} \right) +\gamma\,y_{{g}}\mu_{{1,1}} \left( \mu_{{2,0}}+ \mu_{{0,2}} \right) }{d}}\\ \noalign{\medskip}{\frac {\beta\, \left( \mu_{{2,1}} \left( \mu_{{0,2}}-\mu_{{2,0}} \right) +\mu_{{1,1}} \left( \mu_{{3,0}}-\mu_{{1,2}} \right) \right) +\gamma\,x_{{g}}\mu_{ {1,1}} \left( \mu_{{2,0}}+\mu_{{0,2}} \right) +\gamma\,y_{{g}} \left( \mu_{{2,0}} \left( \mu_{{0,2}}-\mu_{{2,0}} \right) -2\,{\mu_{{1,1}}}^{ 2} \right) }{d}}\\ \noalign{\medskip}-1\end {array} \right] }^t \]

with ${\it DA} = \mu_{{2,0}}-\mu_{{0,2}}$ and ${\it d} = DA^2+4{\mu_{1,1}}^2$.

  • In the discrete case: $beta = 4$, $gamma = 2$.
  • In the dense case: $beta = 5$, $gamma = 1$.

The interaction matrix computed is single-dimension (no selection possible) and can be obtained by calling vpFeatureMomentAlpha::interaction().

This feature is often used in moment-based visual servoing to control the planar rotation parameter.

Minimum vpMomentObject order needed to compute this feature: 4.

This feature depends on:

Examples
manServoMomentsSimple.cpp.

Definition at line 162 of file vpFeatureMomentAlpha.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
FEATURE_ALL 

Definition at line 81 of file vpBasicFeature.h.

◆ vpBasicFeatureDeallocatorType

Indicates who should deallocate the feature.

Enumerator
user 
vpServo 

Definition at line 87 of file vpBasicFeature.h.

Constructor & Destructor Documentation

◆ vpFeatureMomentAlpha()

vpFeatureMomentAlpha::vpFeatureMomentAlpha ( 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 177 of file vpFeatureMomentAlpha.h.

Member Function Documentation

◆ compute_interaction()

void vpFeatureMomentAlpha::compute_interaction ( void  )
virtual

Computes interaction matrix for alpha moment. Called internally. The moment primitives must be computed before calling this. This feature depends on:

Reimplemented from vpFeatureMoment.

Definition at line 93 of file vpFeatureMomentAlpha.cpp.

◆ dimension_s()

unsigned int vpBasicFeature::dimension_s ( )
inlineinherited

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

Definition at line 109 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 113 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 127 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 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 219 of file vpFeatureMoment.cpp.

◆ error()

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

Compute the error between two visual features from a subset of the possible features.

Reimplemented from vpBasicFeature.

Definition at line 166 of file vpFeatureMomentAlpha.cpp.

References vpBasicFeature::s, and vpColVector::stack().

◆ get_s()

vpColVector vpBasicFeature::get_s ( unsigned int  select = FEATURE_ALL) const
inherited

Get the feature vector $\bf s$.

Examples
servoAfma6Ellipse2DCamVelocity.cpp.

Definition at line 113 of file vpBasicFeature.cpp.

◆ getDeallocate()

vpBasicFeatureDeallocatorType vpBasicFeature::getDeallocate ( )
inlineinherited

Definition at line 122 of file vpBasicFeature.h.

◆ getDimension()

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

Feature's dimension according to selection.

Definition at line 84 of file vpFeatureMoment.cpp.

◆ getMoment()

const vpMoment& vpFeatureMoment::getMoment ( ) const
inlineprotectedinherited

Definition at line 162 of file vpFeatureMoment.h.

◆ init()

void vpFeatureMoment::init ( void  )
virtualinherited

Initialize common parameters for moment features.

Implements vpBasicFeature.

Definition at line 55 of file vpFeatureMoment.cpp.

◆ interaction()

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

◆ linkTo()

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

◆ momentName()

const char* vpFeatureMomentAlpha::momentName ( ) const
inlinevirtual

Associated moment name.

Implements vpFeatureMoment.

Definition at line 187 of file vpFeatureMomentAlpha.h.

◆ name()

const char* vpFeatureMomentAlpha::name ( ) const
inlinevirtual

Feature name.

Implements vpFeatureMoment.

Definition at line 191 of file vpFeatureMomentAlpha.h.

◆ operator[]()

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

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

Definition at line 129 of file vpBasicFeature.h.

◆ print()

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

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

◆ resetFlags()

void vpBasicFeature::resetFlags ( )
protectedinherited

Definition at line 130 of file vpBasicFeature.cpp.

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

◆ selectAll()

static unsigned int vpBasicFeature::selectAll ( )
inlinestaticinherited

Select all the features.

Definition at line 141 of file vpBasicFeature.h.

◆ setDeallocate()

void vpBasicFeature::setDeallocate ( vpBasicFeatureDeallocatorType  d)
inlineinherited

Definition at line 136 of file vpBasicFeature.h.

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

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

Member Data Documentation

◆ _name

char vpFeatureMoment::_name[255]
protectedinherited

Definition at line 170 of file vpFeatureMoment.h.

◆ A

double vpFeatureMoment::A
protectedinherited

Definition at line 167 of file vpFeatureMoment.h.

◆ B

double vpFeatureMoment::B
protectedinherited

Definition at line 168 of file vpFeatureMoment.h.

◆ C

double vpFeatureMoment::C
protectedinherited

Definition at line 169 of file vpFeatureMoment.h.

◆ deallocate

vpBasicFeatureDeallocatorType vpBasicFeature::deallocate
protectedinherited

Definition at line 147 of file vpBasicFeature.h.

◆ dim_s

unsigned int vpBasicFeature::dim_s
protectedinherited

Dimension of the visual feature.

Definition at line 93 of file vpBasicFeature.h.

Referenced by vpGenericFeature::duplicate(), vpFeatureVanishingPoint::init(), vpFeatureEllipse::init(), and vpFeatureLuminance::init().

◆ 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 vpFeatureEllipse::selectMu02(), vpFeatureEllipse::selectMu11(), vpFeatureEllipse::selectMu20(), vpFeatureVanishingPoint::selectY(), and vpFeatureEllipse::selectY().

◆ featureMomentsDataBase

vpFeatureMomentDatabase* vpFeatureMoment::featureMomentsDataBase
protectedinherited

Definition at line 164 of file vpFeatureMoment.h.

◆ flags

bool* vpBasicFeature::flags
protectedinherited

◆ interaction_matrices

std::vector<vpMatrix> vpFeatureMoment::interaction_matrices
protectedinherited

Definition at line 165 of file vpFeatureMoment.h.

◆ moment

const vpMoment* vpFeatureMoment::moment
protectedinherited

Definition at line 161 of file vpFeatureMoment.h.

◆ moments

vpMomentDatabase& vpFeatureMoment::moments
protectedinherited

Definition at line 163 of file vpFeatureMoment.h.

◆ nbParameters

unsigned int vpBasicFeature::nbParameters
protectedinherited

◆ s