Visual Servoing Platform
version 3.2.0 under development (2019-01-22)
|
#include <visp3/visual_features/vpFeatureLine.h>
Public Types | |
enum | { FEATURE_ALL = 0xffff } |
enum | vpBasicFeatureDeallocatorType { user, vpServo } |
Public Member Functions | |
vpFeatureLine () | |
virtual | ~vpFeatureLine () |
void | buildFrom (const double rho, const double theta) |
void | buildFrom (const double rho, const double theta, const double A, const double B, const double C, const double D) |
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 |
vpFeatureLine * | duplicate () const |
vpColVector | error (const vpBasicFeature &s_star, const unsigned int select=FEATURE_ALL) |
double | getRho () const |
double | getTheta () const |
void | init () |
vpMatrix | interaction (const unsigned int select=FEATURE_ALL) |
void | print (const unsigned int select=FEATURE_ALL) const |
void | setRhoTheta (const double rho, const double theta) |
void | setABCD (const double A, const double B, const double C, const double D) |
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 | selectRho () |
static unsigned int | selectTheta () |
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 line visual feature which is composed by two parameters that are and , the polar coordinates of a line.
In this class, the equation of the line in the image plane is given by :
Here and are the coordinates of a point belonging to the line and they are given in meter. The following image shows the meanings of the distance and the angle .
You have to note that the angle has its value between and and that the distance can be positive or negative. The conventions are illustrated by the image above.
The visual features can be set easily from an instance of the classes vpLine, vpMeLine or vpCylinder. For more precision see the class vpFeatureBuilder.
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 line feature that correspond to the 2D equation of a line in the image plan. To control six degrees of freedom, at least four other features must be considered like two other line features for example. First we create a current ( ) 2D line 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 line visual feature, compute the corresponding error vector and finally build the interaction matrix .
Definition at line 195 of file vpFeatureLine.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.
vpFeatureLine::vpFeatureLine | ( | ) |
Default constructor that build a visual feature.
Definition at line 106 of file vpFeatureLine.cpp.
References init().
Referenced by duplicate().
|
inlinevirtual |
Destructor.
Definition at line 209 of file vpFeatureLine.h.
References vpBasicFeature::display(), vpBasicFeature::duplicate(), vpBasicFeature::error(), and vpColor::green.
void vpFeatureLine::buildFrom | ( | const double | rho, |
const double | theta | ||
) |
Build a 2D line visual feature from the line equation parameters and given in the image plan.
See the vpFeatureLine class description for more details about and .
rho | : The parameter. |
theta | : The parameter. |
Definition at line 395 of file vpFeatureLine.cpp.
References vpBasicFeature::flags, and vpBasicFeature::s.
Referenced by vpFeatureBuilder::create().
void vpFeatureLine::buildFrom | ( | const double | rho, |
const double | theta, | ||
const double | A_, | ||
const double | B_, | ||
const double | C_, | ||
const double | D_ | ||
) |
Build a 2D line visual feature from the line equation parameters and given in the image plan. The parameters A, B, C and D which describe the equation of a plan to which the line belongs, are set in the same time.
See the vpFeatureLine class description for more details about and .
The A, B, C, D parameters are needed to compute the interaction matrix associated to a visual feature. Normally, two plans are needed to describe a line (the intersection of those two plans). But to compute the interaction matrix only one plan equation is required. The only one restrictions is that the value of D must not be equal to zero !
rho | : The parameter. |
theta | : The parameter. |
A_ | : A parameter of the plan equation. |
B_ | : B parameter of the plan equation. |
C_ | : C parameter of the plan equation. |
D_ | : D parameter of the plan equation. |
Definition at line 431 of file vpFeatureLine.cpp.
References vpBasicFeature::flags, vpBasicFeature::nbParameters, and vpBasicFeature::s.
|
inlineinherited |
Return the dimension of the feature vector .
Definition at line 110 of file vpBasicFeature.h.
References vpColor::green.
|
virtual |
Display line feature.
cam | : Camera parameters. |
I | : Image on which features have to be displayed. |
color | : Color used to display the feature. |
thickness | : Thickness of the feature representation. |
Implements vpBasicFeature.
Definition at line 470 of file vpFeatureLine.cpp.
References vpFeatureDisplay::displayLine(), getRho(), getTheta(), and vpERROR_TRACE.
|
virtual |
Display line feature.
cam | : Camera parameters. |
I | : Color image on which features have to be displayed. |
color | : Color used to display the feature. |
thickness | : Thickness of the feature representation. |
Implements vpBasicFeature.
Definition at line 496 of file vpFeatureLine.cpp.
References vpFeatureDisplay::displayLine(), getRho(), getTheta(), and vpERROR_TRACE.
|
virtual |
Create an object with the same type.
Implements vpBasicFeature.
Definition at line 454 of file vpFeatureLine.cpp.
References vpFeatureLine().
|
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 line features.
|
The code below shows how to use this method to manipulate the subset:
Reimplemented from vpBasicFeature.
Definition at line 318 of file vpFeatureLine.cpp.
References vpBasicFeature::s, selectRho(), selectTheta(), and vpColVector::stack().
Referenced by vpPoseFeatures::addFeatureSegment().
|
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().
|
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().
|
inline |
Return the subset value of the visual feature .
Definition at line 228 of file vpFeatureLine.h.
Referenced by vpMbtDistanceLine::computeInteractionMatrixError(), vpMbtDistanceCylinder::computeInteractionMatrixError(), vpFeatureBuilder::create(), and display().
|
inline |
Return the subset value of the visual feature .
Definition at line 233 of file vpFeatureLine.h.
References vpBasicFeature::init(), vpBasicFeature::interaction(), and vpBasicFeature::print().
Referenced by vpMbtDistanceLine::computeInteractionMatrixError(), vpMbtDistanceCylinder::computeInteractionMatrixError(), vpFeatureBuilder::create(), and display().
|
virtual |
Initialize the memory space requested for 2D line visual feature.
Implements vpBasicFeature.
Definition at line 84 of file vpFeatureLine.cpp.
References vpBasicFeature::dim_s, vpBasicFeature::flags, vpBasicFeature::nbParameters, vpColVector::resize(), and vpBasicFeature::s.
Referenced by vpFeatureLine().
|
virtual |
Compute and return the interaction matrix . The computation is made thanks to the values of the line feature and and the equation of a plan to which the line belongs.
Where :
select | : Selection of a subset of the possible line 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 198 of file vpFeatureLine.cpp.
References vpFeatureException::badInitializationError, vpBasicFeature::deallocate, vpBasicFeature::flags, vpBasicFeature::nbParameters, vpBasicFeature::resetFlags(), vpBasicFeature::s, selectRho(), selectTheta(), vpMatrix::stack(), vpBasicFeature::user, vpERROR_TRACE, and vpTRACE.
Referenced by vpPoseFeatures::addFeatureSegment(), vpMbtDistanceLine::computeInteractionMatrixError(), and vpMbtDistanceCylinder::computeInteractionMatrixError().
|
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 line features.
|
Implements vpBasicFeature.
Definition at line 369 of file vpFeatureLine.cpp.
References vpBasicFeature::s, selectRho(), and selectTheta().
|
protectedinherited |
Definition at line 131 of file vpBasicFeature.cpp.
References vpBasicFeature::flags, and vpBasicFeature::nbParameters.
Referenced by vpFeatureVanishingPoint::interaction(), vpFeatureEllipse::interaction(), vpFeatureDepth::interaction(), vpFeaturePoint::interaction(), 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 line 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 530 of file vpFeatureLine.cpp.
References vpBasicFeature::FEATURE_LINE.
Referenced by error(), interaction(), and print().
|
static |
Function used to select the subset of the line 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 551 of file vpFeatureLine.cpp.
References vpBasicFeature::FEATURE_LINE.
Referenced by error(), interaction(), and print().
void vpFeatureLine::setABCD | ( | const double | A_, |
const double | B_, | ||
const double | C_, | ||
const double | D_ | ||
) |
Sets the values of A, B, C and D which represent the parameters used to describe the equation of a plan in the camera frame.
Those parameters are needed to compute the interaction matrix associated to a visual feature. Normally, two plans are needed to describe a line (the intersection of those two plans). But to compute the interaction matrix only one plan equation is required. The only one restrictions is that the value of D must not be equal to zero !
A_ | : A value to set. |
B_ | : B value to set. |
C_ | : C value to set. |
D_ | : D value to set. |
Definition at line 137 of file vpFeatureLine.cpp.
References vpBasicFeature::flags, and vpBasicFeature::nbParameters.
Referenced by vpFeatureBuilder::create().
|
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.
void vpFeatureLine::setRhoTheta | ( | const double | rho, |
const double | theta | ||
) |
Sets the values of and which represent the parameters of the 2D line feature.
rho | : value to set. |
theta | : value to set. |
Definition at line 115 of file vpFeatureLine.cpp.
References vpBasicFeature::flags, and vpBasicFeature::s.
Referenced by vpFeatureBuilder::create().
|
protectedinherited |
Definition at line 148 of file vpBasicFeature.h.
Referenced by vpFeatureVanishingPoint::interaction(), vpFeatureEllipse::interaction(), vpFeatureSegment::interaction(), vpFeatureDepth::interaction(), vpFeaturePoint::interaction(), 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(), vpFeaturePoint::init(), vpFeatureMoment::init(), 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(), selectRho(), vpFeaturePointPolar::selectRho(), selectTheta(), vpFeaturePointPolar::selectTheta(), vpFeatureThetaU::selectTUx(), vpFeatureThetaU::selectTUy(), vpFeatureThetaU::selectTUz(), vpFeatureTranslation::selectTx(), vpFeatureTranslation::selectTy(), vpFeatureTranslation::selectTz(), vpFeatureVanishingPoint::selectX(), vpFeatureEllipse::selectX(), vpFeaturePoint::selectX(), vpFeaturePoint3D::selectX(), vpFeatureSegment::selectXc(), vpFeatureVanishingPoint::selectY(), vpFeatureEllipse::selectY(), vpFeaturePoint::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(), vpFeaturePoint::buildFrom(), buildFrom(), vpFeaturePoint3D::buildFrom(), vpFeatureThetaU::buildFrom(), vpFeaturePointPolar::buildFrom(), vpFeatureTranslation::buildFrom(), vpFeatureMoment::duplicate(), vpFeatureVanishingPoint::init(), vpFeatureEllipse::init(), vpFeatureLuminance::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), vpFeaturePoint::init(), vpFeatureMoment::init(), init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), vpFeatureTranslation::init(), vpFeatureVanishingPoint::interaction(), vpFeatureEllipse::interaction(), vpFeatureSegment::interaction(), vpFeatureDepth::interaction(), vpFeaturePoint::interaction(), 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(), 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(), setABCD(), vpBasicFeature::setFlags(), vpFeatureEllipse::setMu(), 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(), vpFeaturePoint::buildFrom(), buildFrom(), vpFeaturePoint3D::buildFrom(), vpFeatureThetaU::buildFrom(), vpFeaturePointPolar::buildFrom(), vpFeatureMoment::duplicate(), vpFeatureVanishingPoint::init(), vpFeatureEllipse::init(), vpFeatureLuminance::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), vpFeaturePoint::init(), vpFeatureMoment::init(), init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), vpFeatureTranslation::init(), vpFeatureVanishingPoint::interaction(), vpFeatureEllipse::interaction(), vpFeatureSegment::interaction(), vpFeatureDepth::interaction(), vpFeaturePoint::interaction(), interaction(), vpFeaturePoint3D::interaction(), vpFeatureThetaU::interaction(), vpFeaturePointPolar::interaction(), vpFeatureTranslation::interaction(), vpBasicFeature::operator=(), vpBasicFeature::resetFlags(), vpFeaturePointPolar::set_rhoThetaZ(), vpFeaturePoint::set_xyZ(), vpFeaturePoint3D::set_XYZ(), vpFeatureDepth::set_xyZLogZoverZstar(), vpFeatureEllipse::setABC(), 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(), vpFeaturePoint::buildFrom(), 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(), vpFeaturePoint::error(), 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(), vpFeaturePoint::get_x(), vpFeaturePoint3D::get_X(), vpFeatureVanishingPoint::get_y(), vpFeaturePoint::get_y(), vpFeaturePoint3D::get_Y(), vpFeaturePoint3D::get_Z(), vpBasicFeature::getDimension(), vpFeatureVanishingPoint::init(), vpFeatureEllipse::init(), vpFeatureLuminance::init(), vpFeatureSegment::init(), vpFeatureDepth::init(), vpGenericFeature::init(), vpFeaturePoint::init(), vpFeatureMoment::init(), init(), vpFeaturePoint3D::init(), vpFeatureThetaU::init(), vpFeaturePointPolar::init(), vpFeatureTranslation::init(), vpFeatureEllipse::interaction(), interaction(), vpFeatureThetaU::interaction(), vpFeatureTranslation::interaction(), vpBasicFeature::operator=(), vpFeatureEllipse::print(), vpFeatureSegment::print(), vpGenericFeature::print(), vpFeatureMoment::print(), 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(), 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(), setRhoTheta(), vpFeatureMoment::update(), and vpGenericFeature::vpGenericFeature().