Visual Servoing Platform  version 3.6.1 under development (2024-03-18)

#include <visp3/me/vpMeLine.h>

+ Inheritance diagram for vpMeLine:

Public Member Functions

 vpMeLine ()
 
 vpMeLine (const vpMeLine &meline)
 
virtual ~vpMeLine () vp_override
 
void display (const vpImage< unsigned char > &I, const vpColor &color, unsigned int thickness=1)
 
void track (const vpImage< unsigned char > &I)
 
virtual void sample (const vpImage< unsigned char > &I, bool doNotTrack=false) vp_override
 
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)
 
Public Member Functions Inherited from vpTracker
vpColVector get_p () const
 
vpColVector get_cP () const
 

Static Public Member Functions

static bool intersection (const vpMeLine &line1, const vpMeLine &line2, vpImagePoint &ip)
 
static void displayLine (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 displayLine (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 displayLine (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 displayLine (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 vp_deprecated 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 vp_deprecated 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 vp_deprecated 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 vp_deprecated 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)
 
Deprecated functions
static vp_deprecated bool inMask (const vpImage< bool > *mask, unsigned int i, unsigned int j)
 

Public Attributes

Public Attributes Inherited from vpTracker
vpColVector p
 
vpColVector cP
 
bool cPAvailable
 

Protected Attributes

vpMeSite m_PExt [2]
 
double m_rho
 
double m_theta
 
double m_delta
 
double m_delta_1
 
double m_angle
 
double m_angle_1
 
int m_sign
 
bool m_useIntensityForRho
 
double m_a
 
double m_b
 
double m_c
 
Protected Attributes Inherited from vpMeTracker
std::list< vpMeSitem_meList
 
vpMem_me
 
unsigned int m_init_range
 
int m_nGoodElement
 
const vpImage< bool > * m_mask
 
const vpImage< bool > * m_maskCandidates
 
vpMeSite::vpMeSiteDisplayType m_selectDisplay
 

Public Member Functions Inherited from vpMeTracker

void display (const vpImage< unsigned char > &I)
 
void display (const vpImage< vpRGBa > &I)
 
void display (const vpImage< unsigned char > &I, vpColVector &w, unsigned int &index_w)
 
unsigned int getInitRange ()
 
vpMegetMe ()
 
std::list< vpMeSite > & getMeList ()
 
std::list< vpMeSitegetMeList () const
 
int getNbPoints () const
 
void init ()
 
unsigned int numberOfSignal ()
 
bool outOfImage (int i, int j, int border, int nrows, int ncols)
 
bool outOfImage (const vpImagePoint &iP, int border, int nrows, int ncols)
 
void reset ()
 
void setDisplay (vpMeSite::vpMeSiteDisplayType select)
 
void setInitRange (const unsigned int &r)
 
virtual void setMask (const vpImage< bool > &mask)
 
virtual void setMaskCandidates (const vpImage< bool > *maskCandidates)
 
void setMe (vpMe *me)
 
void setMeList (const std::list< vpMeSite > &meList)
 
unsigned int totalNumberOfSignal ()
 
static bool inRoiMask (const vpImage< bool > *mask, unsigned int i, unsigned int j)
 
static bool inMeMaskCandidates (const vpImage< bool > *meMaskCandidates, unsigned int i, unsigned int j)
 

Detailed Description

Class that tracks in an image a line moving edges.

In this class the line is defined by its equation in the $ (i,j) = (line,column) $ image plane. Two kinds of parametrization are available to describe a 2D line. The first one corresponds to the following equation

\[ ai + bj + c = 0 \]

where $ i $ and $ j $ are the coordinates of the points belonging to the line. The line features are $ (a, b, c) $.

The second way to write the line equation is to consider polar coordinates

\[ i \; cos(\theta) + j \; sin(\theta) - \rho = 0 \]

where $ i $ and $ j $ are still the coordinates of the points belonging to the line. But now the line features are $ (\rho, \theta) $. The computation of $ \rho $ and $ \theta $ is easy thanks to $ (a, b, c) $.

\[ \theta = arctan(b/a) \]

\[ \rho = -c/\sqrt{a^2+b^2} \]

The value of $ \theta $ is between $ 0 $ and $ 2\pi $. And the value of $ \rho $ can be positive or negative. The conventions to find the right values of the two features are illustrated in the following pictures.

The angle $\theta$ 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.

#include <visp3/core/vpConfig.h>
#ifdef VISP_HAVE_MODULE_SENSOR
#include <visp3/sensor/vp1394CMUGrabber.h>
#include <visp3/sensor/vp1394TwoGrabber.h>
#include <visp3/sensor/vpV4l2Grabber.h>
#endif
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayOpenCV.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/me/vpMeLine.h>
#if defined(HAVE_OPENCV_VIDEOIO)
#include <opencv2/videoio.hpp>
#endif
int main()
{
#if (defined(VISP_HAVE_DC1394) || defined(VISP_HAVE_CMU1394) || defined(VISP_HAVE_V4L2) || defined(HAVE_OPENCV_VIDEOIO))
try {
#if defined(VISP_HAVE_DC1394)
vp1394TwoGrabber g(false);
#elif defined(VISP_HAVE_CMU1394)
#elif defined(VISP_HAVE_V4L2)
#elif defined(HAVE_OPENCV_VIDEOIO)
cv::VideoCapture g(0); // open the default camera
if (!g.isOpened()) { // check if we succeeded
std::cout << "Failed to open the camera" << std::endl;
return EXIT_FAILURE;
}
cv::Mat frame;
#endif
#if defined(VISP_HAVE_DC1394) || defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_CMU1394)
g.acquire(I);
#elif defined(HAVE_OPENCV_VIDEOIO)
g >> frame; // get a new frame from camera
#endif
#if defined(VISP_HAVE_X11)
vpDisplayX d(I, 0, 0, "Camera view");
#elif defined(VISP_HAVE_GDI)
vpDisplayGDI d(I, 0, 0, "Camera view");
#elif defined(HAVE_OPENCV_HIGHGUI)
vpDisplayOpenCV d(I, 0, 0, "Camera view");
#else
std::cout << "No image viewer is available..." << std::endl;
#endif
vpMe me;
me.setRange(25);
me.setThreshold(20);
me.setSampleStep(10);
vpMeLine line;
line.setMe(&me);
line.initTracking(I);
while (1) {
#if defined(VISP_HAVE_DC1394) || defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_CMU1394)
g.acquire(I);
#elif defined(HAVE_OPENCV_VIDEOIO)
g >> frame;
#endif
line.track(I);
}
}
catch (const vpException &e) {
std::cout << "Catch an exception: " << e << std::endl;
}
#endif
}
Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
void acquire(vpImage< unsigned char > &I)
Class for firewire ieee1394 video devices using libdc1394-2.x api.
static const vpColor red
Definition: vpColor.h:211
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:128
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
Definition: vpDisplayX.h:128
static void display(const vpImage< unsigned char > &I)
static void flush(const vpImage< unsigned char > &I)
error that can be emitted by ViSP classes.
Definition: vpException.h:59
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
Class that tracks in an image a line moving edges.
Definition: vpMeLine.h:147
void display(const vpImage< unsigned char > &I, const vpColor &color, unsigned int thickness=1)
Definition: vpMeLine.cpp:192
void track(const vpImage< unsigned char > &I)
Definition: vpMeLine.cpp:662
void initTracking(const vpImage< unsigned char > &I)
Definition: vpMeLine.cpp:197
@ RANGE_RESULT
Definition: vpMeSite.h:75
void setDisplay(vpMeSite::vpMeSiteDisplayType select)
Definition: vpMeTracker.h:250
void setMe(vpMe *me)
Definition: vpMeTracker.h:278
Definition: vpMe.h:124
void setRange(const unsigned int &range)
Definition: vpMe.h:429
void setLikelihoodThresholdType(const vpLikelihoodThresholdType likelihood_threshold_type)
Definition: vpMe.h:519
void setThreshold(const double &threshold)
Definition: vpMe.h:480
void setSampleStep(const double &sample_step)
Definition: vpMe.h:436
@ NORMALIZED_THRESHOLD
Definition: vpMe.h:135
Class that is a wrapper over the Video4Linux2 (V4L2) driver.

The code below shows how to use this class.

#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/core/vpImagePoint.h>
#include <visp3/me/vpMeLine.h>
int main()
{
// Fill the image with a black rectangle
I = 0;
for (int i = 100; i < 180; i ++) {
for (int j = 120; j < 250; j ++) {
I[i][j] = 255;
}
}
// Set the moving-edges tracker parameters
vpMe me;
me.setRange(25);
me.setThreshold(20);
me.setSampleStep(10);
// Initialize the moving-edges line tracker parameters
vpMeLine line;
line.setMe(&me);
// Initialize the location of the vertical line to track
vpImagePoint ip1, ip2; // Two points belonging to the line to track
ip1.set_i( 120 );
ip1.set_j( 119 );
ip2.set_i( 170 );
ip2.set_j( 122 );
line.initTracking(I, ip1, ip2);
while ( 1 )
{
// ... Here the code to read or grab the next image.
// Track the line.
line.track(I);
}
return 0;
}
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:82
void set_j(double jj)
Definition: vpImagePoint.h:304
void set_i(double ii)
Definition: vpImagePoint.h:293
Note
It is possible to display the line as an overlay. For that you must use the display function of the class vpMeLine.
Examples
servoAfma62DhalfCamVelocity.cpp, servoAfma6Cylinder2DCamVelocity.cpp, servoAfma6Cylinder2DCamVelocitySecondaryTask.cpp, servoAfma6Line2DCamVelocity.cpp, servoAfma6SquareLines2DCamVelocity.cpp, servoAfma6TwoLines2DCamVelocity.cpp, trackMeLine.cpp, and tutorial-me-line-tracker.cpp.

Definition at line 146 of file vpMeLine.h.

Constructor & Destructor Documentation

◆ vpMeLine() [1/2]

vpMeLine::vpMeLine ( )

Basic constructor that calls the constructor of the class vpMeTracker.

Definition at line 89 of file vpMeLine.cpp.

◆ vpMeLine() [2/2]

vpMeLine::vpMeLine ( const vpMeLine meline)

Copy constructor.

Definition at line 94 of file vpMeLine.cpp.

References m_a, m_angle, m_angle_1, m_b, m_c, m_delta, m_delta_1, m_PExt, m_rho, m_sign, m_theta, and m_useIntensityForRho.

◆ ~vpMeLine()

vpMeLine::~vpMeLine ( )
virtual

Destructor.

Definition at line 115 of file vpMeLine.cpp.

References vpMeTracker::m_meList.

Member Function Documentation

◆ computeRhoSignFromIntensity()

void vpMeLine::computeRhoSignFromIntensity ( bool  useIntensityForRho)
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.

Parameters
useIntensityForRho: new value of the flag.

Definition at line 359 of file vpMeLine.h.

◆ computeRhoTheta()

void vpMeLine::computeRhoTheta ( const vpImage< unsigned char > &  I)

◆ display() [1/8]

void vpMeTracker::display ( const vpImage< unsigned char > &  I)
inherited

Display the moving edge sites with a color corresponding to their state.

  • If green : The vpMeSite is a good point.
  • If blue : The point is removed because of the vpMeSite tracking phase (contrast problem).
  • If purple : The point is removed because of the vpMeSite tracking phase (threshold problem).
  • If red : The point is removed because of the robust method in the virtual visual servoing (M-Estimator problem).
  • If cyan : The point is removed because it's too close to another.
  • Yellow otherwise.
Parameters
I: The image.

Definition at line 258 of file vpMeTracker.cpp.

References vpMeSite::display(), and vpMeTracker::m_meList.

Referenced by vpMeTracker::display(), vpMeEllipse::initTracking(), vpMeEllipse::track(), and track().

◆ display() [2/8]

void vpMeLine::display ( const vpImage< unsigned char > &  I,
const vpColor color,
unsigned int  thickness = 1 
)

Display line.

Warning
To effectively display the line a call to vpDisplay::flush() is needed.
Parameters
I: Image in which the line appears.
color: Color of the displayed line. Note that a moving edge that is considered as an outlier is displayed in green.
thickness: Drawings thickness.
Examples
servoAfma62DhalfCamVelocity.cpp, servoAfma6Cylinder2DCamVelocity.cpp, servoAfma6Cylinder2DCamVelocitySecondaryTask.cpp, servoAfma6Line2DCamVelocity.cpp, servoAfma6SquareLines2DCamVelocity.cpp, servoAfma6TwoLines2DCamVelocity.cpp, trackMeLine.cpp, and tutorial-me-line-tracker.cpp.

Definition at line 192 of file vpMeLine.cpp.

References displayLine(), m_a, m_b, m_c, vpMeTracker::m_meList, and m_PExt.

Referenced by track().

◆ display() [3/8]

void vpMeLine::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
Deprecated:
Use rather displayLine().
Deprecated:
This static function is deprecated. You should rather use vpMeLine::displayLine().

Display of a moving line thanks to its equation parameters and its extremities.

Parameters
I: The image used as background.
PExt1: First extremity
PExt2: Second extremity
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 921 of file vpMeLine.cpp.

References displayLine().

◆ display() [4/8]

void vpMeLine::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
Deprecated:
Use rather displayLine().
Deprecated:
This static function is deprecated. You should rather use vpMeLine::displayLine().

Display of a moving line thanks to its equation parameters and its extremities with all the site list.

Parameters
I: The image used as background.
PExt1: First extremity
PExt2: Second extremity
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 977 of file vpMeLine.cpp.

References displayLine().

◆ display() [5/8]

void vpMeTracker::display ( const vpImage< unsigned char > &  I,
vpColVector w,
unsigned int &  index_w 
)
inherited

Displays the status of moving edge sites

Parameters
I: The image.
w: vector
index_w: index

Definition at line 276 of file vpMeTracker.cpp.

References vpMeTracker::display(), vpMeSite::getState(), vpMeTracker::m_meList, vpMeSite::NO_SUPPRESSION, and vpMeSite::setWeight().

◆ display() [6/8]

void vpMeTracker::display ( const vpImage< vpRGBa > &  I)
inherited

Display the moving edge sites with a color corresponding to their state.

  • If green : The vpMeSite is a good point.
  • If blue : The point is removed because of the vpMeSite tracking phase (contrast problem).
  • If purple : The point is removed because of the vpMeSite tracking phase (threshold problem).
  • If red : The point is removed because of the robust method in the virtual visual servoing (M-Estimator problem).
  • If cyan : The point is removed because it's too close to another.
  • Yellow otherwise.
Parameters
I: The image.

Definition at line 267 of file vpMeTracker.cpp.

References vpMeSite::display(), and vpMeTracker::m_meList.

◆ display() [7/8]

void vpMeLine::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
Deprecated:
Use rather displayLine().
Deprecated:
This static function is deprecated. You should rather use vpMeLine::displayLine().

Display of a moving line thanks to its equation parameters and its extremities.

Parameters
I: The image used as background.
PExt1: First extremity
PExt2: Second extremity
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 948 of file vpMeLine.cpp.

References displayLine().

◆ display() [8/8]

void vpMeLine::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
Deprecated:
Use rather displayLine().
Deprecated:
This static function is deprecated. You should rather use vpMeLine::displayLine().

Display of a moving line thanks to its equation parameters and its extremities with all the site list.

Parameters
I: The image used as background.
PExt1: First extremity
PExt2: Second extremity
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 1007 of file vpMeLine.cpp.

References displayLine().

◆ displayLine() [1/4]

void vpMeLine::displayLine ( 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

Display of a moving line thanks to its equation parameters and its extremities.

Parameters
I: The image used as background.
PExt1: First extremity
PExt2: Second extremity
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 1016 of file vpMeLine.cpp.

References vpDisplay::displayCross(), vpDisplay::displayLine(), vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpColor::green, vpMeSite::m_ifloat, vpMeSite::m_jfloat, vpImagePoint::set_i(), and vpImagePoint::set_j().

Referenced by display().

◆ displayLine() [2/4]

void vpMeLine::displayLine ( 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

Display of a moving line thanks to its equation parameters and its extremities with all the site list.

Parameters
I: The image used as background.
PExt1: First extremity
PExt2: Second extremity
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 1098 of file vpMeLine.cpp.

References vpDisplay::displayCross(), vpDisplay::displayLine(), vpImage< Type >::getHeight(), vpMeSite::getState(), vpImage< Type >::getWidth(), vpColor::green, vpMeSite::M_ESTIMATOR, vpMeSite::m_ifloat, vpMeSite::m_jfloat, vpImagePoint::set_i(), and vpImagePoint::set_j().

◆ displayLine() [3/4]

void vpMeLine::displayLine ( 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

Display of a moving line thanks to its equation parameters and its extremities.

Parameters
I: The image used as background.
PExt1: First extremity
PExt2: Second extremity
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 1057 of file vpMeLine.cpp.

References vpDisplay::displayCross(), vpDisplay::displayLine(), vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpColor::green, vpMeSite::m_ifloat, vpMeSite::m_jfloat, vpImagePoint::set_i(), and vpImagePoint::set_j().

◆ displayLine() [4/4]

void vpMeLine::displayLine ( 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

Display of a moving line thanks to its equation parameters and its extremities with all the site list.

Parameters
I: The image used as background.
PExt1: First extremity
PExt2: Second extremity
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 1153 of file vpMeLine.cpp.

References vpDisplay::displayCross(), vpDisplay::displayLine(), vpImage< Type >::getHeight(), vpMeSite::getState(), vpImage< Type >::getWidth(), vpColor::green, vpMeSite::M_ESTIMATOR, vpMeSite::m_ifloat, vpMeSite::m_jfloat, vpImagePoint::set_i(), and vpImagePoint::set_j().

◆ get_cP()

vpColVector vpTracker::get_cP ( ) const
inlineinherited

Return object parameters expressed in the 3D camera frame.

Definition at line 93 of file vpTracker.h.

◆ get_p()

vpColVector vpTracker::get_p ( ) const
inlineinherited

Return object parameters expressed in the 2D image plane computed by perspective projection.

Definition at line 91 of file vpTracker.h.

◆ getA()

double vpMeLine::getA ( ) const
inline

Gets parameter a of the line equation a*i + b*j + c = 0

Definition at line 325 of file vpMeLine.h.

◆ getB()

double vpMeLine::getB ( ) const
inline

Gets parameter b of the line equation a*i + b*j + c = 0

Definition at line 330 of file vpMeLine.h.

◆ getC()

double vpMeLine::getC ( ) const
inline

Gets parameter c of the line equation a*i + b*j + c = 0

Definition at line 335 of file vpMeLine.h.

◆ getEquationParam()

void vpMeLine::getEquationParam ( double &  A,
double &  B,
double &  C 
)
inline

Gets the equation parameters of the line

Definition at line 315 of file vpMeLine.h.

◆ getExtremities()

void vpMeLine::getExtremities ( vpImagePoint ip1,
vpImagePoint ip2 
)

Get the extremities of the line.

Parameters
ip1: Coordinates of the first extremity.
ip2: Coordinates of the second extremity.

Definition at line 836 of file vpMeLine.cpp.

References m_PExt, vpImagePoint::set_i(), and vpImagePoint::set_j().

◆ getInitRange()

unsigned int vpMeTracker::getInitRange ( )
inlineinherited

Return the initial range.

Returns
Value of init_range.

Definition at line 164 of file vpMeTracker.h.

◆ getMe()

vpMe* vpMeTracker::getMe ( )
inlineinherited

Return the moving edges initialisation parameters.

Returns
Moving Edges.
Examples
trackMeCircle.cpp, and trackMeEllipse.cpp.

Definition at line 171 of file vpMeTracker.h.

◆ getMeList() [1/2]

std::list<vpMeSite>& vpMeTracker::getMeList ( )
inlineinherited

Return the list of moving edges

Returns
List of Moving Edges.

Definition at line 178 of file vpMeTracker.h.

◆ getMeList() [2/2]

std::list<vpMeSite> vpMeTracker::getMeList ( ) const
inlineinherited

Return the list of moving edges

Returns
List of Moving Edges.

Definition at line 185 of file vpMeTracker.h.

◆ getNbPoints()

int vpMeTracker::getNbPoints ( ) const
inlineinherited

Return the number of points that has not been suppressed.

Returns
Number of good points.

Definition at line 192 of file vpMeTracker.h.

◆ getRho()

double vpMeLine::getRho ( ) const

Get the value of $\rho$, 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, $\rho$ is signed.

Examples
trackMeLine.cpp.

Definition at line 832 of file vpMeLine.cpp.

References m_rho.

Referenced by vpFeatureBuilder::create().

◆ getTheta()

double vpMeLine::getTheta ( ) const

Get the value of the angle $\theta$.

Examples
trackMeLine.cpp.

Definition at line 834 of file vpMeLine.cpp.

References m_theta.

Referenced by vpFeatureBuilder::create().

◆ init()

void vpMeTracker::init ( void  )
inherited

Initialize the tracker.

Definition at line 50 of file vpMeTracker.cpp.

References vpTracker::init(), vpMeTracker::m_selectDisplay, vpMeSite::NONE, vpTracker::p, and vpColVector::resize().

Referenced by vpMeTracker::vpMeTracker().

◆ initTracking() [1/2]

void vpMeLine::initTracking ( const vpImage< unsigned char > &  I)

◆ initTracking() [2/2]

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.

Parameters
I: Image in which the line appears.
ip1: Coordinates of the first point.
ip2: Coordinates of the second point.

Definition at line 373 of file vpMeLine.cpp.

References vpImagePoint::get_i(), vpImagePoint::get_j(), vpMeTracker::initTracking(), m_a, m_b, m_delta, m_delta_1, vpMeSite::m_ifloat, vpMeSite::m_jfloat, m_PExt, vpMath::round(), sample(), track(), vpCDEBUG, and vpERROR_TRACE.

◆ inMask()

static vp_deprecated bool vpMeTracker::inMask ( const vpImage< bool > *  mask,
unsigned int  i,
unsigned int  j 
)
inlinestaticinherited
Deprecated:
You should rather use inRoiMask(). Test whether the pixel is inside the region of interest mask. Mask values that are set to true are considered in the tracking.
Parameters
maskMask corresponding to the region of interest in the image or nullptr 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 317 of file vpMeTracker.h.

◆ inMeMaskCandidates()

bool vpMeTracker::inMeMaskCandidates ( const vpImage< bool > *  meMaskCandidates,
unsigned int  i,
unsigned int  j 
)
staticinherited

Test whether the moving-edge (ME) is inside the mask of ME candidates for the initialization. Mask values that are set to true and their 8 neighbors are considered for the initialization.

Parameters
meMaskCandidatesMask corresponding the ME location in the image or nullptr if not wanted. Mask values that are set to true are considered for the initialization. To disable a pixel, set false.
i: ME coordinate along the rows.
j: ME coordinate along the columns.

Definition at line 116 of file vpMeTracker.cpp.

References vpImage< Type >::getCols(), and vpImage< Type >::getRows().

Referenced by vpMeEllipse::sample(), sample(), and seekExtremities().

◆ inRoiMask()

bool vpMeTracker::inRoiMask ( const vpImage< bool > *  mask,
unsigned int  i,
unsigned int  j 
)
staticinherited

Test whether the pixel is inside the region of interest mask. Mask values that are set to true are considered in the tracking.

Parameters
maskMask corresponding to the region of interest in the image or nullptr 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 106 of file vpMeTracker.cpp.

References vpImage< Type >::getValue().

Referenced by vpMbtFaceDepthDense::computeDesiredFeatures(), vpMbtFaceDepthNormal::computeDesiredFeatures(), vpMbtDistanceKltPoints::computeNbDetectedCurrent(), vpMbtDistanceKltPoints::init(), vpMeEllipse::plugHoles(), vpMeEllipse::sample(), sample(), seekExtremities(), and vpMeTracker::track().

◆ intersection()

bool vpMeLine::intersection ( const vpMeLine line1,
const vpMeLine line2,
vpImagePoint ip 
)
static

Computes the intersection point of two lines. The result is given in the (i,j) frame.

Parameters
line1: The first line.
line2: The second line.
ip: The coordinates of the intersection point.
Returns
Returns a boolean value which depends on the computation success. True means that the computation ends successfully.
Examples
servoAfma62DhalfCamVelocity.cpp.

Definition at line 845 of file vpMeLine.cpp.

References m_a, m_b, m_c, vpImagePoint::set_i(), and vpImagePoint::set_j().

◆ leastSquare()

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 223 of file vpMeLine.cpp.

References vpMeSite::getState(), m_a, m_b, m_c, m_delta, vpMeSite::M_ESTIMATOR, vpMeSite::m_ifloat, vpMeSite::m_jfloat, vpMeTracker::m_meList, vpRobust::MEstimator(), vpMeSite::NO_SUPPRESSION, vpTrackingException::notEnoughPointError, vpMeTracker::numberOfSignal(), vpMatrix::pseudoInverse(), vpRobust::setMinMedianAbsoluteDeviation(), vpMeSite::setState(), vpMath::sqr(), vpRobust::TUKEY, and vpCDEBUG.

Referenced by track().

◆ numberOfSignal()

unsigned int vpMeTracker::numberOfSignal ( )
inherited

Return number of moving-edges that are tracked.

Definition at line 95 of file vpMeTracker.cpp.

References vpMeTracker::m_meList.

Referenced by leastSquare(), vpMeEllipse::leastSquareRobust(), vpMeNurbs::localReSample(), reSample(), and vpMeNurbs::reSample().

◆ outOfImage() [1/2]

bool vpMeTracker::outOfImage ( const vpImagePoint iP,
int  border,
int  nrows,
int  ncols 
)
inherited

Check if a pixel i,j is out of the image.

Parameters
[in]iP: Pixel coordinates.
[in]border: Number of pixels along the image border to exclude. When border is set to 0, consider the complete image.
[in]nrows,ncols: Size of the image.
Returns
true when the pixel is inside the image minus the border size, false otherwise.

Definition at line 175 of file vpMeTracker.cpp.

References vpImagePoint::get_i(), vpImagePoint::get_j(), and vpMath::round().

◆ outOfImage() [2/2]

bool vpMeTracker::outOfImage ( int  i,
int  j,
int  border,
int  nrows,
int  ncols 
)
inherited

Check if a pixel i,j is out of the image.

Parameters
[in]i,j: Pixel coordinates.
[in]border: Number of pixels along the image border to exclude. When border is set to 0, consider the complete image.
[in]nrows,ncols: Size of the image.
Returns
true when the pixel is inside the image minus the border size, false otherwise.

Definition at line 167 of file vpMeTracker.cpp.

Referenced by vpMeNurbs::localReSample(), vpMeEllipse::plugHoles(), vpMeNurbs::sample(), vpMeEllipse::sample(), sample(), seekExtremities(), and vpMeNurbs::seekExtremities().

◆ reSample()

void vpMeLine::reSample ( const vpImage< unsigned char > &  I)

Resample the line if the number of sample is less than 80% of the expected value.

Note
The expected value is computed thanks to the length of the line and the parameter which indicates the number of pixel between two points (vpMe::sample_step).
Parameters
I: Image in which the line appears.

Definition at line 594 of file vpMeLine.cpp.

References vpMe::getSampleStep(), vpTrackingException::initializationError, vpMeTracker::initTracking(), m_a, m_b, m_c, m_delta, m_delta_1, vpMeSite::m_ifloat, vpMeSite::m_jfloat, vpMeTracker::m_me, m_PExt, vpMeTracker::numberOfSignal(), sample(), vpMath::sqr(), and vpDERROR_TRACE.

Referenced by track().

◆ reset()

void vpMeTracker::reset ( )
inherited

Reset the tracker by removing all the moving edges.

Definition at line 75 of file vpMeTracker.cpp.

References vpMeTracker::m_meList, and vpMeTracker::m_nGoodElement.

Referenced by vpMeTracker::~vpMeTracker().

◆ sample()

◆ seekExtremities()

◆ setDisplay()

◆ setExtremities()

void vpMeLine::setExtremities ( )

Seek in the list of available points the two extremities of the line.

Definition at line 437 of file vpMeLine.cpp.

References vpMeSite::m_ifloat, vpMeSite::m_jfloat, vpMeTracker::m_meList, and m_PExt.

Referenced by track().

◆ setInitRange()

void vpMeTracker::setInitRange ( const unsigned int &  r)
inlineinherited

Set the initial range.

Parameters
r: initial range.

Definition at line 257 of file vpMeTracker.h.

◆ setMask()

virtual void vpMeTracker::setMask ( const vpImage< bool > &  mask)
inlinevirtualinherited

Set the mask.

Parameters
mask: Mask.

Definition at line 264 of file vpMeTracker.h.

◆ setMaskCandidates()

virtual void vpMeTracker::setMaskCandidates ( const vpImage< bool > *  maskCandidates)
inlinevirtualinherited

Set the mask of candidates points for initialization.

Parameters
maskCandidates: Pointer towards the mask of candidates points for initialization.

Definition at line 271 of file vpMeTracker.h.

◆ setMe()

◆ setMeList()

void vpMeTracker::setMeList ( const std::list< vpMeSite > &  meList)
inlineinherited

Set the list of moving edges.

Parameters
meList: List of Moving Edges.

Definition at line 285 of file vpMeTracker.h.

◆ suppressPoints()

void vpMeLine::suppressPoints ( )

Suppression of the points which belong no more to the line.

Definition at line 424 of file vpMeLine.cpp.

References vpMeSite::getState(), vpMeTracker::m_meList, and vpMeSite::NO_SUPPRESSION.

Referenced by track().

◆ totalNumberOfSignal()

unsigned int vpMeTracker::totalNumberOfSignal ( )
inherited

Return the total number of moving-edges.

Definition at line 104 of file vpMeTracker.cpp.

References vpMeTracker::m_meList.

◆ track()

◆ updateDelta()

void vpMeLine::updateDelta ( )

Set the alpha value of the different vpMeSite to the value of delta.

Definition at line 627 of file vpMeLine.cpp.

References m_angle_1, m_delta, m_delta_1, vpMeSite::m_mask_sign, vpMeTracker::m_meList, m_sign, vpMath::round(), and vpMeSite::setAlpha().

Referenced by track().

Member Data Documentation

◆ cP

◆ cPAvailable

bool vpTracker::cPAvailable
inherited

Flag used to indicate if the feature parameters cP expressed in the camera frame are available.

Definition at line 77 of file vpTracker.h.

Referenced by vpTracker::init(), and vpTracker::operator=().

◆ m_a

double vpMeLine::m_a
protected

Parameter a of the line equation a*i + b*j + c = 0.

Definition at line 166 of file vpMeLine.h.

Referenced by computeRhoTheta(), display(), initTracking(), intersection(), leastSquare(), reSample(), and vpMeLine().

◆ m_angle

double vpMeLine::m_angle
protected

Angle in deg between the extremities.

Definition at line 158 of file vpMeLine.h.

Referenced by vpMeLine().

◆ m_angle_1

double vpMeLine::m_angle_1
protected

Angle in deg between the extremities.

Definition at line 159 of file vpMeLine.h.

Referenced by updateDelta(), and vpMeLine().

◆ m_b

double vpMeLine::m_b
protected

Parameter b of the line equation a*i + b*j + c = 0.

Definition at line 167 of file vpMeLine.h.

Referenced by computeRhoTheta(), display(), initTracking(), intersection(), leastSquare(), reSample(), and vpMeLine().

◆ m_c

double vpMeLine::m_c
protected

Parameter c of the line equation a*i + b*j + c = 0.

Definition at line 168 of file vpMeLine.h.

Referenced by computeRhoTheta(), display(), intersection(), leastSquare(), reSample(), and vpMeLine().

◆ m_delta

double vpMeLine::m_delta
protected

Angle in rad between the extremities.

Definition at line 156 of file vpMeLine.h.

Referenced by initTracking(), leastSquare(), reSample(), sample(), updateDelta(), and vpMeLine().

◆ m_delta_1

double vpMeLine::m_delta_1
protected

Angle in rad between the extremities.

Definition at line 157 of file vpMeLine.h.

Referenced by initTracking(), reSample(), seekExtremities(), updateDelta(), and vpMeLine().

◆ m_init_range

unsigned int vpMeTracker::m_init_range
protectedinherited

Initial range.

Definition at line 70 of file vpMeTracker.h.

Referenced by vpMeTracker::initTracking(), vpMeTracker::operator=(), and vpMeTracker::vpMeTracker().

◆ m_mask

const vpImage<bool>* vpMeTracker::m_mask
protectedinherited

Mask used to disable tracking on a part of image.

Definition at line 74 of file vpMeTracker.h.

Referenced by vpMeEllipse::plugHoles(), vpMeEllipse::sample(), sample(), seekExtremities(), and vpMeTracker::track().

◆ m_maskCandidates

const vpImage<bool>* vpMeTracker::m_maskCandidates
protectedinherited

Mask used to determine candidate points for initialization in an image.

Definition at line 76 of file vpMeTracker.h.

Referenced by vpMeEllipse::sample(), sample(), and seekExtremities().

◆ m_me

◆ m_meList

◆ m_nGoodElement

int vpMeTracker::m_nGoodElement
protectedinherited

Number of good moving-edges that are tracked.

Definition at line 72 of file vpMeTracker.h.

Referenced by vpMeTracker::initTracking(), vpMeTracker::operator=(), vpMeTracker::reset(), vpMeTracker::track(), and vpMeTracker::vpMeTracker().

◆ m_PExt

vpMeSite vpMeLine::m_PExt[2]
protected

◆ m_rho

double vpMeLine::m_rho
protected

rho parameter of the line

Definition at line 154 of file vpMeLine.h.

Referenced by computeRhoTheta(), getRho(), and vpMeLine().

◆ m_selectDisplay

◆ m_sign

int vpMeLine::m_sign
protected

Sign.

Definition at line 160 of file vpMeLine.h.

Referenced by sample(), seekExtremities(), updateDelta(), and vpMeLine().

◆ m_theta

double vpMeLine::m_theta
protected

theta parameter of the line

Definition at line 155 of file vpMeLine.h.

Referenced by computeRhoTheta(), getTheta(), and vpMeLine().

◆ m_useIntensityForRho

bool vpMeLine::m_useIntensityForRho
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 164 of file vpMeLine.h.

Referenced by computeRhoTheta(), and vpMeLine().

◆ p