Visual Servoing Platform
version 3.1.0
|
#include <visp3/visual_features/vpFeaturePoint.h>
Public Types | |
enum | { FEATURE_ALL = 0xffff } |
enum | vpBasicFeatureDeallocatorType { user, vpServo } |
Deprecated functions | |
enum | vpFeaturePointType { X = 1, Y = 2 } |
Public Member Functions | |
vpFeaturePoint () | |
virtual | ~vpFeaturePoint () |
void | buildFrom (const double x, const double y, const double Z) |
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 |
vpFeaturePoint * | duplicate () const |
vpColVector | error (const vpBasicFeature &s_star, const unsigned int select=FEATURE_ALL) |
vpColVector | error (const unsigned int select=FEATURE_ALL) |
double | get_x () const |
double | get_y () const |
double | get_Z () const |
void | init () |
vpMatrix | interaction (const unsigned int select=FEATURE_ALL) |
void | print (const unsigned int select=FEATURE_ALL) const |
void | set_x (const double x) |
void | set_y (const double y) |
void | set_Z (const double Z) |
void | set_xyZ (const double x, const double y, const double Z) |
Inherited functionalities from vpBasicFeature | |
unsigned int | dimension_s () |
vpColVector | get_s (unsigned int select=FEATURE_ALL) const |
vpBasicFeatureDeallocatorType | getDeallocate () |
unsigned int | getDimension (const unsigned int select=FEATURE_ALL) const |
virtual double | operator[] (const unsigned int i) const |
void | setDeallocate (vpBasicFeatureDeallocatorType d) |
void | setFlags () |
Static Public Member Functions | |
static unsigned int | selectX () |
static unsigned int | selectY () |
static unsigned int | selectAll () |
Static Public Attributes | |
static const unsigned int | FEATURE_LINE [32] |
Protected Member Functions | |
void | resetFlags () |
Protected Attributes | |
vpColVector | s |
unsigned int | dim_s |
bool * | flags |
unsigned int | nbParameters |
vpBasicFeatureDeallocatorType | deallocate |
Class that defines a 2D point visual feature which is composed by two parameters that are the cartesian coordinates and .
In this class and are the 2D coordinates in the image plane and are given in meter. which is the 3D coordinate representing the depth is also a parameter of the point. It is needed during the computation of the interaction matrix .
The visual features can be set easily from an instance of the classes vpPoint, vpDot or vpDot2. For more precision see the vpFeatureBuilder class.
Once the values of the visual features are set, the interaction() method allows to compute the interaction matrix associated to the visual feature, while the error() method computes the error vector between the current visual feature and the desired one.
The code below shows how to create a eye-in hand visual servoing task using a 2D point feature that correspond to the 2D coordinates of a point in the image plane. To control six degrees of freedom, at least four other features must be considered like two other point features for example. First we create a current ( ) 2D point feature. Then we set the task to use the interaction matrix associated to the current feature . And finally we compute the camera velocity . The current feature is updated in the while() loop.
If you want to build your own control law, this other example shows how to create a current ( ) and desired ( ) 2D point visual feature, compute the corresponding error vector and finally build the interaction matrix .
An other fully explained example is given in the Tutorial: Image-based visual servo.
Definition at line 181 of file vpFeaturePoint.h.
|
inherited |
Enumerator | |
---|---|
FEATURE_ALL |
Definition at line 82 of file vpBasicFeature.h.
|
inherited |
Indicates who should deallocate the feature.
Enumerator | |
---|---|
user | |
vpServo |
Definition at line 88 of file vpBasicFeature.h.
Enumerator | |
---|---|
X | |
Y |
Definition at line 232 of file vpFeaturePoint.h.
vpFeaturePoint::vpFeaturePoint | ( | ) |
Default constructor that build a visual feature.
Definition at line 89 of file vpFeaturePoint.cpp.
References init().
Referenced by duplicate().
|
inlinevirtual |
Destructor.
Definition at line 191 of file vpFeaturePoint.h.
References vpBasicFeature::display(), vpBasicFeature::duplicate(), vpBasicFeature::error(), vpColor::green, vpBasicFeature::init(), vpBasicFeature::interaction(), and vpBasicFeature::print().
void vpFeaturePoint::buildFrom | ( | const double | x_, |
const double | y_, | ||
const double | Z_ | ||
) |
Build a 2D point visual feature from the point coordinates in the image plan and . The parameter Z which describes the depth, is set in the same time.
See the vpFeaturePoint class description for more details about and .
x_ | : The parameter. |
y_ | : The parameter. |
Z_ | : The parameter. |
Definition at line 395 of file vpFeaturePoint.cpp.
References vpFeatureException::badInitializationError, vpBasicFeature::flags, vpBasicFeature::nbParameters, vpBasicFeature::s, and vpERROR_TRACE.
|
inlineinherited |
Return the dimension of the feature vector .
Definition at line 110 of file vpBasicFeature.h.
References vpColor::green.
|
virtual |
Display point feature.
cam | : Camera parameters. |
I | : Image. |
color | : Color to use for the display. |
thickness | : Thickness of the feature representation. |
Implements vpBasicFeature.
Definition at line 431 of file vpFeaturePoint.cpp.
References vpFeatureDisplay::displayPoint(), get_x(), get_y(), and vpERROR_TRACE.
|
virtual |
Display point feature.
cam | : Camera parameters. |
I | : color Image. |
color | : Color to use for the display. |
thickness | : Thickness of the feature representation. |
Implements vpBasicFeature.
Definition at line 457 of file vpFeaturePoint.cpp.
References vpFeatureDisplay::displayPoint(), get_x(), get_y(), and vpERROR_TRACE.
|
virtual |
Create an object with the same type.
Implements vpBasicFeature.
Definition at line 483 of file vpFeaturePoint.cpp.
References vpFeaturePoint().
|
virtual |
Compute the error between the current and the desired visual features from a subset of the possible features.
s_star | : Desired visual feature. |
select | : The error can be computed for a selection of a subset of the possible point features.
|
The code below shows how to use this method to manipulate the subset:
Reimplemented from vpBasicFeature.
Definition at line 329 of file vpFeaturePoint.cpp.
References vpBasicFeature::s, selectX(), selectY(), and vpColVector::stack().
Referenced by vpPoseFeatures::addFeatureSegment().
vpColVector vpFeaturePoint::error | ( | const unsigned int | select = FEATURE_ALL | ) |
Compute the error between a visual features and zero.
|
inherited |
Get the feature vector .
Definition at line 114 of file vpBasicFeature.cpp.
References vpBasicFeature::dim_s, vpBasicFeature::FEATURE_LINE, vpBasicFeature::s, and vpColVector::stack().
Referenced by vpServo::computeError(), vpBasicFeature::error(), vpFeatureDepth::error(), vpGenericFeature::error(), vpFeatureThetaU::error(), vpFeatureTranslation::error(), and vpGenericFeature::getInteractionMatrix().
double vpFeaturePoint::get_x | ( | ) | const |
Get the value of which represents the x coordinate of the point in the image plan. It is one parameter of the visual feature .
Definition at line 130 of file vpFeaturePoint.cpp.
References vpBasicFeature::s.
Referenced by display(), interaction(), and print().
double vpFeaturePoint::get_y | ( | ) | const |
Get the value of which represents the x coordinate of the point in the image plan. It is one parameter of the visual feature .
Definition at line 150 of file vpFeaturePoint.cpp.
References vpBasicFeature::s.
Referenced by display(), interaction(), and print().
double vpFeaturePoint::get_Z | ( | ) | const |
Get the value of which represents the depth in the 3D camera frame.
Definition at line 109 of file vpFeaturePoint.cpp.
Referenced by vpFeatureBuilder::create(), interaction(), and print().
|
inlineinherited |
Definition at line 123 of file vpBasicFeature.h.
|
inherited |
Get the feature vector dimension.
Definition at line 100 of file vpBasicFeature.cpp.
References vpBasicFeature::dim_s, vpBasicFeature::FEATURE_LINE, vpArray2D< Type >::getRows(), and vpBasicFeature::s.
Referenced by vpFeatureMoment::vpFeatureMoment().
|
virtual |
Initialize the memory space requested for 2D point visual feature.
Implements vpBasicFeature.
Definition at line 69 of file vpFeaturePoint.cpp.
References vpBasicFeature::dim_s, vpBasicFeature::flags, vpBasicFeature::nbParameters, vpColVector::resize(), and vpBasicFeature::s.
Referenced by vpFeaturePoint().
|
virtual |
Compute and return the interaction matrix . The computation is made thanks to the values of the point features and and the depth .
select | : Selection of a subset of the possible point features.
|
The code below shows how to compute the interaction matrix associated to the visual feature .
The code below shows how to compute the interaction matrix associated to the visual feature .
Implements vpBasicFeature.
Definition at line 215 of file vpFeaturePoint.cpp.
References vpFeatureException::badInitializationError, vpBasicFeature::deallocate, vpBasicFeature::flags, get_x(), get_y(), get_Z(), vpBasicFeature::nbParameters, vpBasicFeature::resetFlags(), vpArray2D< Type >::resize(), selectX(), selectY(), vpMatrix::stack(), vpBasicFeature::user, vpERROR_TRACE, and vpTRACE.
Referenced by vpPoseFeatures::addFeatureSegment().
|
inlinevirtualinherited |
Return element i in the state vector (usage : x = s[i] )
Definition at line 130 of file vpBasicFeature.h.
|
virtual |
Print to stdout the values of the current visual feature .
select | : Selection of a subset of the possible point features.
|
Implements vpBasicFeature.
Definition at line 372 of file vpFeaturePoint.cpp.
References get_x(), get_y(), get_Z(), selectX(), and selectY().
|
protectedinherited |
Definition at line 131 of file vpBasicFeature.cpp.
References vpBasicFeature::flags, and vpBasicFeature::nbParameters.
Referenced by vpFeatureVanishingPoint::interaction(), vpFeatureEllipse::interaction(), vpFeatureDepth::interaction(), interaction(), vpFeatureLine::interaction(), vpFeaturePoint3D::interaction(), vpFeatureThetaU::interaction(), vpFeaturePointPolar::interaction(), and vpFeatureTranslation::interaction().
|
inlinestaticinherited |
Select all the features.
Definition at line 142 of file vpBasicFeature.h.
|
static |
Function used to select the subset of the point visual feature.
This function is to use in conjunction with interaction() in order to compute the interaction matrix associated to .
This function is also useful in the vpServo class to indicate that a subset of the visual feature is to use in the control law:
Definition at line 507 of file vpFeaturePoint.cpp.
References vpBasicFeature::FEATURE_LINE.
Referenced by error(), interaction(), and print().
|
static |
Function used to select the subset of the point visual feature.
This function is to use in conjunction with interaction() in order to compute the interaction matrix associated to .
This function is also useful in the vpServo class to indicate that a subset of the visual feature is to use in the control law:
Definition at line 527 of file vpFeaturePoint.cpp.
References vpBasicFeature::FEATURE_LINE.
Referenced by error(), interaction(), and print().
void vpFeaturePoint::set_x | ( | const double | x | ) |
Set the value of which represents the x coordinate of the point in image plan. It is one parameter of the visual feature .
x | : value to set. |
Definition at line 118 of file vpFeaturePoint.cpp.
References vpBasicFeature::flags, and vpBasicFeature::s.
Referenced by vpFeatureBuilder::create(), and set_xyZ().
void vpFeaturePoint::set_xyZ | ( | const double | x_, |
const double | y_, | ||
const double | Z_ | ||
) |
Set the value of , and . and represent the coordinates of the point in the image plan and are the parameters of the visual feature . is the 3D coordinate in the camera frame representing the depth.
x_ | : value to set. |
y_ | : value to set. |
Z_ | : value to set. |
Definition at line 163 of file vpFeaturePoint.cpp.
References vpBasicFeature::flags, vpBasicFeature::nbParameters, set_x(), set_y(), and set_Z().
void vpFeaturePoint::set_y | ( | const double | y | ) |
Set the value of which represents the x coordinate of the point in the image plan. It is one parameter of the visual feature .
y | : value to set. |
Definition at line 138 of file vpFeaturePoint.cpp.
References vpBasicFeature::flags, and vpBasicFeature::s.
Referenced by vpFeatureBuilder::create(), and set_xyZ().
void vpFeaturePoint::set_Z | ( | const double | Z_ | ) |
Set the value of which represents the depth in the 3D camera frame.
Z_ | : value to set. |
Definition at line 97 of file vpFeaturePoint.cpp.
References vpBasicFeature::flags.
Referenced by vpVirtualGrabber::acquire(), vpFeatureBuilder::create(), and set_xyZ().
|
inlineinherited |
Definition at line 137 of file vpBasicFeature.h.
Referenced by vpServo::addFeature().
|
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.
|
protectedinherited |
Definition at line 148 of file vpBasicFeature.h.
Referenced by vpFeatureVanishingPoint::interaction(), vpFeatureEllipse::interaction(), vpFeatureSegment::interaction(), vpFeatureDepth::interaction(), interaction(), vpFeatureLine::interaction(), vpFeaturePoint3D::interaction(), vpFeatureThetaU::interaction(), vpFeaturePointPolar::interaction(), vpFeatureTranslation::interaction(), and vpBasicFeature::operator=().
|
protectedinherited |
Dimension of the visual feature.
Definition at line 94 of file vpBasicFeature.h.
Referenced by vpGenericFeature::duplicate(), vpFeatureMoment::duplicate(), vpFeatureLuminance::error(), vpBasicFeature::error(), vpGenericFeature::error(), vpBasicFeature::get_s(), vpGenericFeature::get_s(), vpBasicFeature::getDimension(), vpFeatureMoment::getDimension(), vpFeatureVanishingPoint::init(), vpFeatureEllipse::init(), vpFeatureLuminance::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), init(), vpFeatureMoment::init(), vpFeatureLine::init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), vpFeatureTranslation::init(), vpFeatureLuminance::interaction(), vpGenericFeature::interaction(), vpFeatureMoment::interaction(), vpFeatureLuminance::operator=(), vpBasicFeature::operator=(), vpGenericFeature::print(), vpFeatureMoment::print(), vpGenericFeature::set_s(), vpGenericFeature::setError(), vpGenericFeature::setInteractionMatrix(), vpFeatureMoment::update(), vpFeatureLuminance::vpFeatureLuminance(), and vpGenericFeature::vpGenericFeature().
|
staticinherited |
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(), vpFeatureSegment::selectAlpha(), vpFeatureSegment::selectL(), vpFeatureEllipse::selectMu02(), vpFeatureEllipse::selectMu11(), vpFeatureEllipse::selectMu20(), vpFeatureLine::selectRho(), vpFeaturePointPolar::selectRho(), vpFeatureLine::selectTheta(), vpFeaturePointPolar::selectTheta(), vpFeatureThetaU::selectTUx(), vpFeatureThetaU::selectTUy(), vpFeatureThetaU::selectTUz(), vpFeatureTranslation::selectTx(), vpFeatureTranslation::selectTy(), vpFeatureTranslation::selectTz(), vpFeatureVanishingPoint::selectX(), vpFeatureEllipse::selectX(), selectX(), vpFeaturePoint3D::selectX(), vpFeatureSegment::selectXc(), vpFeatureVanishingPoint::selectY(), vpFeatureEllipse::selectY(), selectY(), vpFeaturePoint3D::selectY(), vpFeatureSegment::selectYc(), and vpFeaturePoint3D::selectZ().
|
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(), vpFeatureVanishingPoint::buildFrom(), vpFeatureDepth::buildFrom(), buildFrom(), vpFeatureLine::buildFrom(), vpFeaturePoint3D::buildFrom(), vpFeatureThetaU::buildFrom(), vpFeaturePointPolar::buildFrom(), vpFeatureTranslation::buildFrom(), vpFeatureMoment::duplicate(), vpFeatureVanishingPoint::init(), vpFeatureEllipse::init(), vpFeatureLuminance::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), init(), vpFeatureMoment::init(), vpFeatureLine::init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), vpFeatureTranslation::init(), vpFeatureVanishingPoint::interaction(), vpFeatureEllipse::interaction(), vpFeatureSegment::interaction(), vpFeatureDepth::interaction(), 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(), set_x(), vpFeaturePoint3D::set_X(), vpFeatureEllipse::set_xy(), set_xyZ(), vpFeaturePoint3D::set_XYZ(), vpFeatureDepth::set_xyZLogZoverZstar(), vpFeatureVanishingPoint::set_y(), vpFeatureEllipse::set_y(), vpFeatureDepth::set_y(), set_y(), vpFeaturePoint3D::set_Y(), vpFeatureLuminance::set_Z(), vpFeatureDepth::set_Z(), set_Z(), vpFeaturePoint3D::set_Z(), vpFeaturePointPolar::set_Z(), vpFeatureEllipse::setABC(), vpFeatureLine::setABCD(), vpBasicFeature::setFlags(), vpFeatureEllipse::setMu(), vpFeatureLine::setRhoTheta(), vpFeatureMoment::update(), vpFeatureLuminance::vpFeatureLuminance(), and vpBasicFeature::~vpBasicFeature().
|
protectedinherited |
Number of parameters needed to compute the interaction matrix.
Definition at line 100 of file vpBasicFeature.h.
Referenced by vpFeatureVanishingPoint::buildFrom(), vpFeatureEllipse::buildFrom(), vpFeatureDepth::buildFrom(), buildFrom(), vpFeatureLine::buildFrom(), vpFeaturePoint3D::buildFrom(), vpFeatureThetaU::buildFrom(), vpFeaturePointPolar::buildFrom(), vpFeatureMoment::duplicate(), vpFeatureVanishingPoint::init(), vpFeatureEllipse::init(), vpFeatureLuminance::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), init(), vpFeatureMoment::init(), vpFeatureLine::init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), vpFeatureTranslation::init(), vpFeatureVanishingPoint::interaction(), vpFeatureEllipse::interaction(), vpFeatureSegment::interaction(), vpFeatureDepth::interaction(), interaction(), vpFeatureLine::interaction(), vpFeaturePoint3D::interaction(), vpFeatureThetaU::interaction(), vpFeaturePointPolar::interaction(), vpFeatureTranslation::interaction(), vpBasicFeature::operator=(), vpBasicFeature::resetFlags(), vpFeaturePointPolar::set_rhoThetaZ(), set_xyZ(), vpFeaturePoint3D::set_XYZ(), vpFeatureDepth::set_xyZLogZoverZstar(), vpFeatureEllipse::setABC(), vpFeatureLine::setABCD(), vpBasicFeature::setFlags(), vpFeatureMoment::update(), and vpFeatureLuminance::vpFeatureLuminance().
|
protectedinherited |
State of the visual feature.
Definition at line 92 of file vpBasicFeature.h.
Referenced by vpFeatureEllipse::buildFrom(), vpFeatureVanishingPoint::buildFrom(), vpFeatureLuminance::buildFrom(), vpFeatureDepth::buildFrom(), buildFrom(), vpFeatureLine::buildFrom(), vpFeaturePoint3D::buildFrom(), vpFeatureThetaU::buildFrom(), vpFeaturePointPolar::buildFrom(), vpFeatureTranslation::buildFrom(), vpFeatureEllipse::display(), vpFeatureMoment::duplicate(), vpFeatureVanishingPoint::error(), vpFeatureEllipse::error(), vpFeatureLuminance::error(), vpBasicFeature::error(), vpFeatureDepth::error(), vpFeatureMomentAlpha::error(), vpGenericFeature::error(), 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(), get_x(), vpFeaturePoint3D::get_X(), vpFeatureVanishingPoint::get_y(), get_y(), vpFeaturePoint3D::get_Y(), vpFeaturePoint3D::get_Z(), vpBasicFeature::getDimension(), vpFeatureVanishingPoint::init(), vpFeatureEllipse::init(), vpFeatureLuminance::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), vpGenericFeature::init(), 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(), set_x(), vpFeaturePoint3D::set_X(), vpFeatureEllipse::set_xy(), vpFeatureEllipse::set_y(), vpFeatureVanishingPoint::set_y(), set_y(), vpFeaturePoint3D::set_Y(), vpFeaturePoint3D::set_Z(), vpFeatureEllipse::setMu(), vpFeatureLine::setRhoTheta(), vpFeatureMoment::update(), and vpGenericFeature::vpGenericFeature().