![]() |
Visual Servoing Platform
version 3.2.0
|
#include <vpFeatureMoment.h>
Public Types | |
enum | { FEATURE_ALL = 0xffff } |
enum | vpBasicFeatureDeallocatorType { user, vpServo } |
Public Member Functions | |
vpFeatureMoment (vpMomentDatabase &data_base, double A_=0.0, double B_=0.0, double C_=0.0, vpFeatureMomentDatabase *featureMoments=NULL, unsigned int nbmatrices=1) | |
virtual | ~vpFeatureMoment () |
Static Public Attributes | |
static const unsigned int | FEATURE_LINE [32] |
Protected Member Functions | |
const vpMoment & | getMoment () const |
Protected Attributes | |
const vpMoment * | moment |
vpMomentDatabase & | moments |
vpFeatureMomentDatabase * | featureMomentsDataBase |
std::vector< vpMatrix > | interaction_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 | |
vpBasicFeatureDeallocatorType | deallocate |
void | resetFlags () |
unsigned int | dimension_s () |
virtual vpColVector | error (const vpBasicFeature &s_star, const unsigned int select=FEATURE_ALL) |
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 () |
static unsigned int | selectAll () |
Inherited functionalities from vpFeatureMoment | |
virtual void | compute_interaction (void) |
vpBasicFeature * | duplicate () 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) |
virtual const char * | momentName () const =0 |
virtual const char * | name () const =0 |
void | print (const unsigned int select=FEATURE_ALL) const |
virtual void | printDependencies (std::ostream &os) const |
void | update (double A, double B, double C) |
VISP_EXPORT std::ostream & | operator<< (std::ostream &os, const vpFeatureMoment &featM) |
This class defines shared system methods/attributes for 2D moment features but no functional code. It is used to compute interaction matrices for moment features.
While vpMoment-type classes do only compute moment values and can by used for almost anything, vpFeatureMoment-type classes are specifically designed for visual servoing. More importantly, a vpFeatureMoment is used to compute the interaction matrix associated to it's moment primitive.
This class is virtual and cannot be used directly. It defines the following characteristics common to all moment features:
Like vpMoment, vpFeatureMoment provides a vpFeatureMoment::update() method. But unlike vpMoment::update() which only acknowledges the new object, the vpFeatureMoment::update() acknowledges the new plane parameters AND computes the interaction matrices associated with the feature.
A vpFeatureMoment will be often part of a vpFeatureMomentDatabase in the same way a vpMoment is part of a vpMomentDatabase. This database is specified inside the vpFeatureMoment::vpFeatureMoment() constructor. As a result, a vpFeatureMoment will be able to access other vpFeatureMoments through this database.
A vpBasicFeature can be duplicated into a vpMomentGenericFeature. In that case, all data in the vpBasicFeature is copied but the feature's name is lost. For example if a vpFeatureMomentCInvariant is duplicated, the duplicata will be operational but could not be used in a vpFeatureMomentDatabase.
Note that you can use vpFeatureMoment to do visual servoing but it is not it's only purpose. You may compute your interaction matrices with vpFeatureMoment::update() and use them for any purpose.
Here is an example of how to use a vpFeatureMoment (in this case vpFeatureMomentBasic).
Definition at line 158 of file vpFeatureMoment.h.
|
inherited |
Enumerator | |
---|---|
FEATURE_ALL |
Definition at line 81 of file vpBasicFeature.h.
|
inherited |
Indicates who should deallocate the feature.
Enumerator | |
---|---|
user | |
vpServo |
Definition at line 87 of file vpBasicFeature.h.
|
inline |
Initializes the feature with information about the database of moment primitives, the object plane, feature database and matrix size.
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 ![]() |
B_ | : Plane coefficient in a ![]() |
C_ | : Plane coefficient in a ![]() |
featureMoments | : Feature database |
nbmatrices | : If you want to create a new vpFeatureMoment implementation, your feature will often have a matrix size of n lines. You can specify the number of lines by this parameter. |
Definition at line 203 of file vpFeatureMoment.h.
|
virtual |
Definition at line 257 of file vpFeatureMoment.cpp.
|
virtual |
Reimplemented in vpFeatureMomentGravityCenterNormalized, vpFeatureMomentCInvariant, vpFeatureMomentGravityCenter, vpFeatureMomentAreaNormalized, vpFeatureMomentAlpha, vpFeatureMomentCentered, vpFeatureMomentBasic, and vpFeatureMomentArea.
Definition at line 255 of file vpFeatureMoment.cpp.
|
inlineinherited |
Return the dimension of the feature vector .
Definition at line 109 of file vpBasicFeature.h.
|
virtual |
Not implemented since visual representation of a moment doesn't often make sense.
Implements vpBasicFeature.
Definition at line 113 of file vpFeatureMoment.cpp.
|
virtual |
Not implemented since visual representation of a moment doesn't often make sense.
Implements vpBasicFeature.
Definition at line 127 of file vpFeatureMoment.cpp.
|
virtual |
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.
Implements vpBasicFeature.
Definition at line 219 of file vpFeatureMoment.cpp.
|
virtualinherited |
Compute the error between two visual features from a subset of the possible features.
Reimplemented in vpFeatureTranslation, vpFeaturePointPolar, vpFeatureThetaU, vpFeaturePoint3D, vpFeatureLine, vpFeaturePoint, vpGenericFeature, vpFeatureMomentAlpha, vpFeatureDepth, vpFeatureLuminance, vpFeatureEllipse, vpFeatureVanishingPoint, and vpFeatureSegment.
Definition at line 150 of file vpBasicFeature.cpp.
|
inherited |
Get the feature vector .
Definition at line 113 of file vpBasicFeature.cpp.
|
inlineinherited |
Definition at line 122 of file vpBasicFeature.h.
int vpFeatureMoment::getDimension | ( | unsigned int | select = FEATURE_ALL | ) | const |
Feature's dimension according to selection.
Definition at line 84 of file vpFeatureMoment.cpp.
|
inlineprotected |
Definition at line 162 of file vpFeatureMoment.h.
|
virtual |
Initialize common parameters for moment features.
Implements vpBasicFeature.
Definition at line 55 of file vpFeatureMoment.cpp.
|
virtual |
Retrieves the interaction matrix. No computation is done.
select | : Feature selector. |
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 couple in the
format, but for vpFeatureMomentCInvariant the selector allows to select couples
in the following format: 1 << i
Implements vpBasicFeature.
Definition at line 198 of file vpFeatureMoment.cpp.
void vpFeatureMoment::linkTo | ( | vpFeatureMomentDatabase & | featureMoments | ) |
Links the feature to the feature's database. NB: The feature's database is different from the moment's database.
featureMoments | : database in which the moment features are stored. |
Definition at line 243 of file vpFeatureMoment.cpp.
|
pure virtual |
Name of the moment corresponding to the feature. This allows to locate the moment associated with the feature in the provided database.
Implemented in vpMomentGenericFeature, vpFeatureMomentGravityCenterNormalized, vpFeatureMomentCInvariant, vpFeatureMomentGravityCenter, vpFeatureMomentAreaNormalized, vpFeatureMomentAlpha, vpFeatureMomentCentered, vpFeatureMomentBasic, and vpFeatureMomentArea.
|
pure virtual |
Name of the feature used to locate it in the database of features.
Implemented in vpMomentGenericFeature, vpFeatureMomentGravityCenterNormalized, vpFeatureMomentCInvariant, vpFeatureMomentGravityCenter, vpFeatureMomentAreaNormalized, vpFeatureMomentAlpha, vpFeatureMomentCentered, vpFeatureMomentBasic, and vpFeatureMomentArea.
|
inlinevirtualinherited |
Return element i in the state vector (usage : x = s[i] )
Definition at line 129 of file vpBasicFeature.h.
|
virtual |
Outputs the content of the feature: it's corresponding selected moments.
Implements vpBasicFeature.
Definition at line 98 of file vpFeatureMoment.cpp.
|
virtual |
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.
|
protectedinherited |
Definition at line 130 of file vpBasicFeature.cpp.
References vpBasicFeature::flags, and vpBasicFeature::nbParameters.
|
inlinestaticinherited |
Select all the features.
Definition at line 141 of file vpBasicFeature.h.
|
inlineinherited |
Definition at line 136 of file vpBasicFeature.h.
|
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.
void vpFeatureMoment::update | ( | double | A_, |
double | B_, | ||
double | C_ | ||
) |
Updates the interaction matrices with the image plane the camera is facing. The plane must be in the format: . 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.
A_ | : A coefficient of the plane. |
B_ | : B coefficient of the plane. |
C_ | : C coefficient of the plane. |
Definition at line 152 of file vpFeatureMoment.cpp.
|
friend |
Definition at line 259 of file vpFeatureMoment.cpp.
|
protected |
Definition at line 170 of file vpFeatureMoment.h.
|
protected |
Definition at line 167 of file vpFeatureMoment.h.
|
protected |
Definition at line 168 of file vpFeatureMoment.h.
|
protected |
Definition at line 169 of file vpFeatureMoment.h.
|
protectedinherited |
Definition at line 147 of file vpBasicFeature.h.
|
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().
|
staticinherited |
Definition at line 79 of file vpBasicFeature.h.
Referenced by vpFeatureEllipse::selectMu02(), vpFeatureEllipse::selectMu11(), vpFeatureEllipse::selectMu20(), vpFeatureVanishingPoint::selectY(), and vpFeatureEllipse::selectY().
|
protected |
Definition at line 164 of file vpFeatureMoment.h.
|
protectedinherited |
Ensure that all the parameters needed to compute the iteraction matrix are set.
Definition at line 97 of file vpBasicFeature.h.
Referenced by vpFeatureEllipse::buildFrom(), vpFeatureVanishingPoint::buildFrom(), vpFeatureVanishingPoint::init(), vpFeatureEllipse::init(), vpBasicFeature::resetFlags(), vpFeatureEllipse::set_x(), vpFeatureEllipse::set_xy(), vpFeatureEllipse::set_y(), vpFeatureEllipse::setABC(), and vpFeatureEllipse::setMu().
|
protected |
Definition at line 165 of file vpFeatureMoment.h.
|
protected |
Definition at line 161 of file vpFeatureMoment.h.
|
protected |
Definition at line 163 of file vpFeatureMoment.h.
|
protectedinherited |
Number of parameters needed to compute the interaction matrix.
Definition at line 99 of file vpBasicFeature.h.
Referenced by vpFeatureVanishingPoint::buildFrom(), vpFeatureEllipse::buildFrom(), vpFeatureVanishingPoint::init(), vpFeatureEllipse::init(), vpBasicFeature::resetFlags(), and vpFeatureEllipse::setABC().
|
protectedinherited |
State of the visual feature.
Definition at line 91 of file vpBasicFeature.h.
Referenced by vpFeatureEllipse::buildFrom(), vpFeatureVanishingPoint::buildFrom(), vpFeatureMomentAlpha::error(), vpFeatureVanishingPoint::init(), vpFeatureEllipse::init(), vpFeatureLuminance::init(), vpGenericFeature::init(), vpFeatureEllipse::print(), vpFeatureEllipse::set_x(), vpFeatureEllipse::set_xy(), vpFeatureEllipse::set_y(), and vpFeatureEllipse::setMu().