![]() |
Visual Servoing Platform
version 3.3.0
|
#include <vpMeLine.h>
Public Member Functions | |
vpMeLine () | |
vpMeLine (const vpMeLine &meline) | |
virtual | ~vpMeLine () |
void | display (const vpImage< unsigned char > &I, vpColor col) |
void | track (const vpImage< unsigned char > &Im) |
virtual void | sample (const vpImage< unsigned char > &image, bool doNotTrack=false) |
void | reSample (const vpImage< unsigned char > &I) |
void | leastSquare () |
void | updateDelta () |
void | setExtremities () |
void | seekExtremities (const vpImage< unsigned char > &I) |
void | suppressPoints () |
void | initTracking (const vpImage< unsigned char > &I) |
void | initTracking (const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2) |
void | computeRhoTheta (const vpImage< unsigned char > &I) |
double | getRho () const |
double | getTheta () const |
void | getExtremities (vpImagePoint &ip1, vpImagePoint &ip2) |
void | getEquationParam (double &A, double &B, double &C) |
double | getA () const |
double | getB () const |
double | getC () const |
void | computeRhoSignFromIntensity (bool useIntensityForRho) |
void | init () |
unsigned int | numberOfSignal () |
unsigned int | totalNumberOfSignal () |
virtual void | display (const vpImage< unsigned char > &I) |
virtual void | display (const vpImage< vpRGBa > &I) |
void | display (const vpImage< unsigned char > &I, vpColVector &w, unsigned int &index_w) |
void | setDisplay (vpMeSite::vpMeSiteDisplayType select) |
int | outOfImage (int i, int j, int half, int row, int cols) |
int | outOfImage (const vpImagePoint &iP, int half, int rows, int cols) |
void | reset () |
void | setInitRange (const unsigned int &r) |
unsigned int | getInitRange () |
virtual void | setMask (const vpImage< bool > &mask) |
void | setMe (vpMe *p_me) |
vpMe * | getMe () |
void | setMeList (const std::list< vpMeSite > &l) |
std::list< vpMeSite > & | getMeList () |
std::list< vpMeSite > | getMeList () const |
int | getNbPoints () const |
Static Public Member Functions | |
static bool | intersection (const vpMeLine &line1, const vpMeLine &line2, vpImagePoint &ip) |
static void | display (const vpImage< unsigned char > &I, const vpMeSite &PExt1, const vpMeSite &PExt2, const double &A, const double &B, const double &C, const vpColor &color=vpColor::green, unsigned int thickness=1) |
static void | display (const vpImage< vpRGBa > &I, const vpMeSite &PExt1, const vpMeSite &PExt2, const double &A, const double &B, const double &C, const vpColor &color=vpColor::green, unsigned int thickness=1) |
static void | display (const vpImage< unsigned char > &I, const vpMeSite &PExt1, const vpMeSite &PExt2, const std::list< vpMeSite > &site_list, const double &A, const double &B, const double &C, const vpColor &color=vpColor::green, unsigned int thickness=1) |
static void | display (const vpImage< vpRGBa > &I, const vpMeSite &PExt1, const vpMeSite &PExt2, const std::list< vpMeSite > &site_list, const double &A, const double &B, const double &C, const vpColor &color=vpColor::green, unsigned int thickness=1) |
static bool | inMask (const vpImage< bool > *mask, unsigned int i, unsigned int j) |
Public Attributes | |
double | a |
double | b |
double | c |
std::list< vpMeSite > | list |
vpMe * | me |
unsigned int | init_range |
int | nGoodElement |
const vpImage< bool > * | m_mask |
int | query_range |
bool | display_point |
vpColVector | p |
vpColVector | cP |
bool | cPAvailable |
Protected Attributes | |
vpMeSite | PExt [2] |
double | rho |
double | theta |
double | delta |
double | delta_1 |
double | angle |
double | angle_1 |
int | sign |
bool | _useIntensityForRho |
vpMeSite::vpMeSiteDisplayType | selectDisplay |
Class that tracks in an image a line moving edges.
In this class the line is defined by its equation in the image plane. Two kinds of parametrization are available to describe a 2D line. The first one corresponds to the following equation
where and
are the coordinates of the points belonging to the line. The line features are
.
The second way to write the line equation is to consider polar coordinates
where and
are still the coordinates of the points belonging to the line. But now the line features are
. The computation of
and
is easy thanks to
.
The value of is between
and
. And the value of
can be positive or negative. The conventions to find the right values of the two features are illustrated in the following pictures.
The angle is computed thanks to the direction of the arrow. The arrow points to the side of the line which is darker.
The example below available in tutorial-me-line-tracker.cpp and described in Tutorial: Moving-edges tracking shows how to use this class.
The code below shows how to use this class.
Definition at line 150 of file vpMeLine.h.
vpMeLine::vpMeLine | ( | ) |
Basic constructor that calls the constructor of the class vpMeTracker.
Definition at line 97 of file vpMeLine.cpp.
vpMeLine::vpMeLine | ( | const vpMeLine & | meline | ) |
Copy constructor.
Definition at line 107 of file vpMeLine.cpp.
|
virtual |
Basic destructor.
Definition at line 133 of file vpMeLine.cpp.
|
inline |
This method allows to turn off the computation of the sign of the rho attribute based on the intensity near the middle point of the line. This is usually done to distinguish between a black/white and a white/black edge but it may be source of problem (ex. for a servoing example) when this point can be occluded.
useIntensityForRho | : new value of the flag. |
Definition at line 238 of file vpMeLine.h.
void vpMeLine::computeRhoTheta | ( | const vpImage< unsigned char > & | I | ) |
Compute the two parameters of the line.
I | : Image in which the line appears. |
Definition at line 821 of file vpMeLine.cpp.
|
virtualinherited |
Display the moving edge sites with a color corresponding to their state.
I | : The image. |
Reimplemented in vpMeEllipse.
Definition at line 325 of file vpMeTracker.cpp.
|
static |
Display of a moving line thanks to its equation parameters and its extremities.
I | : The image used as background. |
PExt1 | : First extrimity |
PExt2 | : Second extrimity |
A | : Parameter a of the line equation a*i + b*j + c = 0 |
B | : Parameter b of the line equation a*i + b*j + c = 0 |
C | : Parameter c of the line equation a*i + b*j + c = 0 |
color | : Color used to display the line. |
thickness | : Thickness of the line. |
Definition at line 1063 of file vpMeLine.cpp.
|
static |
Display of a moving line thanks to its equation parameters and its extremities with all the site list.
I | : The image used as background. |
PExt1 | : First extrimity |
PExt2 | : Second extrimity |
site_list | : vpMeSite list |
A | : Parameter a of the line equation a*i + b*j + c = 0 |
B | : Parameter b of the line equation a*i + b*j + c = 0 |
C | : Parameter c of the line equation a*i + b*j + c = 0 |
color | : Color used to display the line. |
thickness | : Thickness of the line. |
Definition at line 1191 of file vpMeLine.cpp.
Display line.
I | : Image in which the line appears. |
col | : Color of the displayed line. Note that a moving edge that is considered as an outlier is displayed in green. |
Implements vpMeTracker.
Definition at line 223 of file vpMeLine.cpp.
|
inherited |
Displays the status of moving edge sites
I | : The image. |
w | : vector |
index_w | : index |
Definition at line 353 of file vpMeTracker.cpp.
Definition at line 339 of file vpMeTracker.cpp.
References vpMeSite::display(), and vpMeTracker::list.
|
static |
Display of a moving line thanks to its equation parameters and its extremities.
I | : The image used as background. |
PExt1 | : First extrimity |
PExt2 | : Second extrimity |
A | : Parameter a of the line equation a*i + b*j + c = 0 |
B | : Parameter b of the line equation a*i + b*j + c = 0 |
C | : Parameter c of the line equation a*i + b*j + c = 0 |
color | : Color used to display the line. |
thickness | : Thickness of the line. |
Definition at line 1126 of file vpMeLine.cpp.
|
static |
Display of a moving line thanks to its equation parameters and its extremities with all the site list.
I | : The image used as background. |
PExt1 | : First extrimity |
PExt2 | : Second extrimity |
site_list | : vpMeSite list |
A | : Parameter a of the line equation a*i + b*j + c = 0 |
B | : Parameter b of the line equation a*i + b*j + c = 0 |
C | : Parameter c of the line equation a*i + b*j + c = 0 |
color | : Color used to display the line. |
thickness | : Thickness of the line. |
Definition at line 1272 of file vpMeLine.cpp.
|
inline |
Gets parameter a of the line equation a*i + b*j + c = 0
Definition at line 215 of file vpMeLine.h.
|
inline |
Gets parameter b of the line equation a*i + b*j + c = 0
Definition at line 220 of file vpMeLine.h.
|
inline |
Gets parameter c of the line equation a*i + b*j + c = 0
Definition at line 225 of file vpMeLine.h.
|
inline |
Gets the equation parameters of the line
Definition at line 205 of file vpMeLine.h.
void vpMeLine::getExtremities | ( | vpImagePoint & | ip1, |
vpImagePoint & | ip2 | ||
) |
Get the extremities of the line.
ip1 | : Coordinates of the first extremity. |
ip2 | : Coordinates of the second extremity. |
Definition at line 969 of file vpMeLine.cpp.
|
inlineinherited |
|
inlineinherited |
Return the moving edges initialisation parameters
Definition at line 151 of file vpMeTracker.h.
|
inlineinherited |
Return the list of moving edges
Definition at line 165 of file vpMeTracker.h.
|
inlineinherited |
Definition at line 166 of file vpMeTracker.h.
|
inlineinherited |
Return the number of points that has not been suppressed.
Definition at line 173 of file vpMeTracker.h.
double vpMeLine::getRho | ( | ) | const |
Get the value of , the distance between the origin and the point on the line with belong to the normal to the line crossing the origin.
Depending on the convention described at the beginning of this class, is signed.
Definition at line 955 of file vpMeLine.cpp.
double vpMeLine::getTheta | ( | ) | const |
|
inherited |
Definition at line 54 of file vpMeTracker.cpp.
References vpTracker::init(), vpMeSite::NONE, vpTracker::p, vpColVector::resize(), and vpMeTracker::selectDisplay.
Referenced by vpMeTracker::vpMeTracker().
void vpMeLine::initTracking | ( | const vpImage< unsigned char > & | I | ) |
Initilization of the tracking. Ask the user to click on two points from the line to track.
I | : Image in which the line appears. |
Definition at line 235 of file vpMeLine.cpp.
void vpMeLine::initTracking | ( | const vpImage< unsigned char > & | I, |
const vpImagePoint & | ip1, | ||
const vpImagePoint & | ip2 | ||
) |
Initialization of the tracking. The line is defined thanks to the coordinates of two points.
I | : Image in which the line appears. |
ip1 | : Coordinates of the first point. |
ip2 | : Coordinates of the second point. |
Definition at line 424 of file vpMeLine.cpp.
|
staticinherited |
Test whether the pixel is inside the mask. Mask values that are set to true are considered in the tracking.
mask | Mask image or NULL if not wanted. Mask values that are set to true are considered in the tracking. To disable a pixel, set false. |
i | : Pixel coordinate along the rows. |
j | : Pixel coordinate along the columns. |
Definition at line 139 of file vpMeTracker.cpp.
Referenced by vpMbtFaceDepthDense::computeDesiredFeatures(), and vpMbtFaceDepthNormal::computeDesiredFeatures().
|
static |
Computes the intersection point of two lines. The result is given in the (i,j) frame.
line1 | : The first line. |
line2 | : The second line. |
ip | : The coordinates of the intersection point. |
Definition at line 990 of file vpMeLine.cpp.
void vpMeLine::leastSquare | ( | ) |
Least squares method used to make the tracking more robust. It ensures that the points taken into account to compute the right equation belong to the line.
Definition at line 264 of file vpMeLine.cpp.
|
inherited |
Definition at line 119 of file vpMeTracker.cpp.
References vpMeTracker::list.
|
inherited |
Definition at line 154 of file vpMeTracker.cpp.
References vpImagePoint::get_i(), vpImagePoint::get_j(), and vpMath::round().
|
inherited |
Definition at line 149 of file vpMeTracker.cpp.
void vpMeLine::reSample | ( | const vpImage< unsigned char > & | I | ) |
Resample the line if the number of sample is less than 80% of the expected value.
I | : Image in which the line appears. |
Definition at line 666 of file vpMeLine.cpp.
|
inherited |
Reset the tracker by removing all the moving edges.
Definition at line 95 of file vpMeTracker.cpp.
Referenced by vpMeTracker::~vpMeTracker().
|
virtual |
Construct a list of vpMeSite moving edges at a particular sampling step between the two extremities of the line.
I | : Image in which the line appears. |
doNotTrack | : Inherited parameter, not used. |
vpTrackingException::initializationError | : Moving edges not initialized. |
Implements vpMeTracker.
Definition at line 147 of file vpMeLine.cpp.
void vpMeLine::seekExtremities | ( | const vpImage< unsigned char > & | I | ) |
Seek along the line defined by its equation, the two extremities of the line. This function is useful in case of translation of the line.
I | : Image in which the line appears. |
vpTrackingException::initializationError | : Moving edges not initialized. |
Definition at line 550 of file vpMeLine.cpp.
|
inlineinherited |
Definition at line 104 of file vpMeTracker.h.
void vpMeLine::setExtremities | ( | ) |
Seek in the list of available points the two extremities of the line.
Definition at line 493 of file vpMeLine.cpp.
|
inlineinherited |
|
inlinevirtualinherited |
|
inlineinherited |
Set the moving edges initialisation parameters
p_me | : Moving Edges. |
Definition at line 144 of file vpMeTracker.h.
|
inlineinherited |
Set the list of moving edges
l | : list of Moving Edges. |
Definition at line 158 of file vpMeTracker.h.
void vpMeLine::suppressPoints | ( | ) |
Suppression of the points which belong no more to the line.
Definition at line 477 of file vpMeLine.cpp.
|
inherited |
Definition at line 128 of file vpMeTracker.cpp.
References vpMeTracker::list.
void vpMeLine::track | ( | const vpImage< unsigned char > & | I | ) |
Track the line in the image I.
I | : Image in which the line appears. |
Definition at line 746 of file vpMeLine.cpp.
void vpMeLine::updateDelta | ( | ) |
Set the alpha value of the different vpMeSite to the value of delta.
Definition at line 705 of file vpMeLine.cpp.
|
protected |
Flag to specify wether the intensity of the image at the middle point is used to compute the sign of rho or not.
Definition at line 165 of file vpMeLine.h.
double vpMeLine::a |
Parameter a of the line equation a*i + b*j + c = 0.
Definition at line 173 of file vpMeLine.h.
|
protected |
Definition at line 160 of file vpMeLine.h.
|
protected |
Definition at line 160 of file vpMeLine.h.
double vpMeLine::b |
Parameter b of the line equation a*i + b*j + c = 0.
Definition at line 174 of file vpMeLine.h.
double vpMeLine::c |
Parameter c of the line equation a*i + b*j + c = 0.
Definition at line 175 of file vpMeLine.h.
|
inherited |
Feature coordinates expressed in the camera frame cP.
Definition at line 74 of file vpTracker.h.
Referenced by vpCircle::init(), vpSphere::init(), vpCylinder::init(), vpTracker::operator=(), and vpPose::printPoint().
|
inherited |
Flag used to indicate if the feature parameters cP expressed in the camera frame are available.
Definition at line 80 of file vpTracker.h.
Referenced by vpTracker::operator=().
|
protected |
Definition at line 159 of file vpMeLine.h.
|
protected |
Definition at line 159 of file vpMeLine.h.
|
inherited |
Definition at line 178 of file vpMeTracker.h.
Referenced by vpMeTracker::operator=(), and vpMeTracker::vpMeTracker().
|
inherited |
Definition at line 76 of file vpMeTracker.h.
Referenced by vpMeTracker::operator=(), and vpMeTracker::vpMeTracker().
|
inherited |
Tracking dependent variables/functions List of tracked moving edges points.
Definition at line 73 of file vpMeTracker.h.
Referenced by vpMeTracker::display(), vpMeTracker::numberOfSignal(), vpMeTracker::operator=(), vpMeTracker::totalNumberOfSignal(), and vpMeTracker::vpMeTracker().
|
inherited |
Mask used to disable tracking on a part of image.
Definition at line 79 of file vpMeTracker.h.
|
inherited |
Moving edges initialisation parameters.
Definition at line 75 of file vpMeTracker.h.
Referenced by vpMeTracker::operator=(), and vpMeTracker::vpMeTracker().
|
inherited |
Definition at line 77 of file vpMeTracker.h.
Referenced by vpMeTracker::operator=(), and vpMeTracker::vpMeTracker().
|
inherited |
Feature coordinates expressed in the image plane p. They correspond to 2D normalized coordinates expressed in meters.
Definition at line 70 of file vpTracker.h.
Referenced by vpCircle::display(), vpSphere::display(), vpProjectionDisplay::display(), vpProjectionDisplay::displayCamera(), vpCircle::init(), vpSphere::init(), vpMeTracker::init(), vpCylinder::init(), vpTracker::operator=(), and vpPose::printPoint().
|
protected |
Definition at line 156 of file vpMeLine.h.
|
inherited |
Definition at line 177 of file vpMeTracker.h.
Referenced by vpMeTracker::operator=(), and vpMeTracker::vpMeTracker().
|
protected |
Definition at line 158 of file vpMeLine.h.
|
protectedinherited |
Definition at line 82 of file vpMeTracker.h.
Referenced by vpMeTracker::init(), vpMeTracker::operator=(), and vpMeTracker::vpMeTracker().
|
protected |
Definition at line 161 of file vpMeLine.h.
|
protected |
Definition at line 158 of file vpMeLine.h.