Visual Servoing Platform  version 3.2.0 under development (2018-12-17)
vpMbtDistanceLine Class Reference

#include <visp3/mbt/vpMbtDistanceLine.h>

Public Member Functions

 vpMbtDistanceLine ()
 
 ~vpMbtDistanceLine ()
 
void addPolygon (const int &index)
 
void buildFrom (vpPoint &_p1, vpPoint &_p2)
 
bool closeToImageBorder (const vpImage< unsigned char > &I, const unsigned int threshold)
 
void computeInteractionMatrixError (const vpHomogeneousMatrix &cMo)
 
void display (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, const unsigned int thickness=1, const bool displayFullModel=false)
 
void display (const vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, const unsigned int thickness=1, const bool displayFullModel=false)
 
void displayMovingEdges (const vpImage< unsigned char > &I)
 
void getCameraParameters (vpCameraParameters &camera) const
 
unsigned int getIndex () const
 
double getMeanWeight () const
 
std::string getName () const
 
vpMbtPolygongetPolygon ()
 
void initInteractionMatrixError ()
 
bool initMovingEdge (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const bool doNotTrack, const vpImage< bool > *mask=NULL)
 
bool isTracked () const
 
bool isVisible () const
 
void reinitMovingEdge (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpImage< bool > *mask=NULL)
 
void setCameraParameters (const vpCameraParameters &camera)
 
void setIndex (const unsigned int i)
 
void setMeanWeight (const double w_mean)
 
void setMovingEdge (vpMe *Me)
 
void setName (const std::string &line_name)
 
void setName (const char *line_name)
 
void setTracked (const std::string &name, const bool &track)
 
void setVisible (bool _isvisible)
 
void trackMovingEdge (const vpImage< unsigned char > &I)
 
void updateMovingEdge (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
 
void updateTracked ()
 

Public Attributes

bool useScanLine
 
std::vector< vpMbtMeLine * > meline
 
vpLineline
 
vpPointp1
 
vpPointp2
 
vpMatrix L
 
vpColVector error
 
std::vector< unsigned int > nbFeature
 
unsigned int nbFeatureTotal
 
bool Reinit
 
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
 
std::list< int > Lindex_polygon
 
std::vector< bool > Lindex_polygon_tracked
 
bool isvisible
 

Detailed Description

Manage the line of a polygon used in the model-based tracker.

Definition at line 66 of file vpMbtDistanceLine.h.

Constructor & Destructor Documentation

vpMbtDistanceLine::vpMbtDistanceLine ( )

Basic constructor

Definition at line 59 of file vpMbtDistanceLine.cpp.

Member Function Documentation

void vpMbtDistanceLine::addPolygon ( const int &  idx)

Add a polygon to the list of polygons the line belongs to.

Parameters
idx: Index of the polygon

Definition at line 216 of file vpMbtDistanceLine.cpp.

References Lindex_polygon, and Lindex_polygon_tracked.

Referenced by vpMbtFaceDepthDense::addLine(), vpMbtFaceDepthNormal::addLine(), vpMbEdgeTracker::addLine(), and vpMbTracker::addProjectionErrorLine().

void vpMbtDistanceLine::buildFrom ( vpPoint _p1,
vpPoint _p2 
)

Build a vpMbtDistanceLine thanks to two points corresponding to the extremities.

Parameters
_p1: The first extremity.
_p2: The second extremity.

Definition at line 166 of file vpMbtDistanceLine.cpp.

References vpPolygon3D::addPoint(), vpColVector::cross(), vpPoint::get_oX(), vpPoint::get_oY(), vpPoint::get_oZ(), line, vpPolygon3D::p, p1, p2, and vpPolygon3D::setNbPoint().

Referenced by vpMbtFaceDepthDense::addLine(), vpMbtFaceDepthNormal::addLine(), vpMbEdgeTracker::addLine(), and vpMbTracker::addProjectionErrorLine().

bool vpMbtDistanceLine::closeToImageBorder ( const vpImage< unsigned char > &  I,
const unsigned int  threshold 
)

Test wether the line is close to the border of the image (at a given threshold)

Parameters
I: the input image (to know its size)
threshold: the threshold in pixel
Returns
true if the line is near the border of the image

Definition at line 810 of file vpMbtDistanceLine.cpp.

References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), isvisible, and meline.

Referenced by vpMbEdgeTracker::computeVVSFirstPhase(), vpMbEdgeTracker::computeVVSFirstPhaseFactor(), and vpMbEdgeKltTracker::trackFirstLoop().

void vpMbtDistanceLine::display ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo,
const vpCameraParameters camera,
const vpColor col,
const unsigned int  thickness = 1,
const bool  displayFullModel = false 
)

Display the line. The 3D line is projected into the image.

Parameters
I: The image.
cMo: Pose used to project the 3D model into the image.
camera: The camera parameters.
col: The desired color.
thickness: The thickness of the line.
displayFullModel: If true, the line is displayed even if it is not visible.

Definition at line 592 of file vpMbtDistanceLine.cpp.

References vpPoint::changeFrame(), vpCameraParameters::computeFov(), vpPolygon3D::computePolygonClipped(), vpMbHiddenFaces< PolygonType >::computeScanLineQuery(), vpMeterPixelConversion::convertPoint(), vpDisplay::displayLine(), vpPolygon3D::DOWN_CLIPPING, vpPolygon3D::FAR_CLIPPING, vpPolygon3D::getClipping(), vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), hiddenface, isvisible, vpPolygon3D::LEFT_CLIPPING, vpPolygon3D::NEAR_CLIPPING, p1, p2, vpPolygon3D::polyClipped, vpPolygon3D::RIGHT_CLIPPING, vpPolygon3D::UP_CLIPPING, and useScanLine.

Referenced by vpMbtFaceDepthDense::display(), and vpMbtFaceDepthNormal::display().

void vpMbtDistanceLine::display ( const vpImage< vpRGBa > &  I,
const vpHomogeneousMatrix cMo,
const vpCameraParameters camera,
const vpColor col,
const unsigned int  thickness = 1,
const bool  displayFullModel = false 
)

Display the line. The 3D line is projected into the image.

Parameters
I: The image.
cMo: Pose used to project the 3D model into the image.
camera: The camera parameters.
col: The desired color.
thickness: The thickness of the line.
displayFullModel: If true, the line is displayed even if it is not visible.

Definition at line 646 of file vpMbtDistanceLine.cpp.

References vpPoint::changeFrame(), vpCameraParameters::computeFov(), vpPolygon3D::computePolygonClipped(), vpMbHiddenFaces< PolygonType >::computeScanLineQuery(), vpMeterPixelConversion::convertPoint(), vpDisplay::displayLine(), vpPolygon3D::DOWN_CLIPPING, vpPolygon3D::FAR_CLIPPING, vpPolygon3D::getClipping(), vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), hiddenface, isvisible, vpPolygon3D::LEFT_CLIPPING, vpPolygon3D::NEAR_CLIPPING, p1, p2, vpPolygon3D::polyClipped, vpPolygon3D::RIGHT_CLIPPING, vpPolygon3D::UP_CLIPPING, and useScanLine.

void vpMbtDistanceLine::displayMovingEdges ( const vpImage< unsigned char > &  I)

Enable to display the points along the line 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 (constrast problem).
  • If purple : The point is removed because of the vpMeSite tracking phase (threshold problem).
  • If blue : The point is removed because of the robust method in the virtual visual servoing.
Parameters
I: The image.

Definition at line 703 of file vpMbtDistanceLine.cpp.

References meline.

Referenced by vpMbEdgeTracker::displayFeaturesOnImage(), and vpMbEdgeKltTracker::postTracking().

void vpMbtDistanceLine::getCameraParameters ( vpCameraParameters camera) const
inline

Get the camera paramters.

Parameters
camera: The vpCameraParameters used to store the camera parameters.

Definition at line 154 of file vpMbtDistanceLine.h.

unsigned int vpMbtDistanceLine::getIndex ( ) const
inline

Get the index of the line.

Returns
Return the index of the line.

Definition at line 161 of file vpMbtDistanceLine.h.

double vpMbtDistanceLine::getMeanWeight ( ) const
inline

Get the mean weight of the line. The mean weight is computed thanks to the weight of each moving edge. Those weights are computed by the robust estimation method used during the virtual visual servoing.

Returns
The mean weight of the line.

Definition at line 170 of file vpMbtDistanceLine.h.

std::string vpMbtDistanceLine::getName ( ) const
inline

Get the name of the line.

Returns
Return the name of the line

Definition at line 177 of file vpMbtDistanceLine.h.

Referenced by vpMbEdgeTracker::removeLine().

void vpMbtDistanceLine::initInteractionMatrixError ( )

Initialize the size of the interaction matrix and the error vector.

Definition at line 714 of file vpMbtDistanceLine.cpp.

References error, isvisible, meline, nbFeature, nbFeatureTotal, and vpColVector::resize().

Referenced by vpMbEdgeKltTracker::initMbtTracking(), and vpMbEdgeTracker::initMbtTracking().

bool vpMbtDistanceLine::initMovingEdge ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo,
const bool  doNotTrack,
const vpImage< bool > *  mask = NULL 
)

Initialize the moving edge thanks to a given pose of the camera. The 3D model is projected into the image to create moving edges along the line.

Parameters
I: The image.
cMo: The pose of the camera used to initialize the moving edges.
doNotTrack: If true, ME are not tracked.
maskMask image or NULL if not wanted. Mask values that are set to true are considered in the tracking. To disable a pixel, set false.
Returns
false if an error occur, true otherwise.

Definition at line 307 of file vpMbtDistanceLine.cpp.

References vpPoint::changeFrame(), vpLine::changeFrame(), vpCameraParameters::computeFov(), vpPolygon3D::computePolygonClipped(), vpMbHiddenFaces< PolygonType >::computeScanLineQuery(), vpMeterPixelConversion::convertLine(), vpMeterPixelConversion::convertPoint(), vpImagePoint::get_i(), vpImagePoint::get_j(), vpPolygon3D::getClipping(), vpImage< Type >::getHeight(), vpLine::getRho(), vpLine::getTheta(), vpImage< Type >::getWidth(), hiddenface, isvisible, line, meline, nbFeature, nbFeatureTotal, p1, p2, vpPolygon3D::polyClipped, vpLine::projection(), and useScanLine.

Referenced by vpMbEdgeTracker::initMovingEdge(), vpMbTracker::projectionErrorInitMovingEdge(), reinitMovingEdge(), and vpMbEdgeTracker::trackMovingEdge().

void vpMbtDistanceLine::reinitMovingEdge ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo,
const vpImage< bool > *  mask = NULL 
)

Reinitialize the line if it is required.

A line is reinitialized if the 2D line do not match enough with the projected 3D line.

Parameters
I: the image.
cMo: The pose of the camera.
maskMask image or NULL if not wanted. Mask values that are set to true are considered in the tracking. To disable a pixel, set false.

Definition at line 564 of file vpMbtDistanceLine.cpp.

References initMovingEdge(), meline, nbFeature, nbFeatureTotal, and Reinit.

Referenced by vpMbEdgeTracker::reInitLevel(), and vpMbEdgeTracker::reinitMovingEdge().

void vpMbtDistanceLine::setCameraParameters ( const vpCameraParameters camera)
inline

Set the camera paramters.

Parameters
camera: The camera parameters.

Definition at line 212 of file vpMbtDistanceLine.h.

Referenced by vpMbtFaceDepthDense::addLine(), vpMbtFaceDepthNormal::addLine(), vpMbEdgeTracker::addLine(), vpMbTracker::addProjectionErrorLine(), and vpMbTracker::computeProjectionErrorImpl().

void vpMbtDistanceLine::setIndex ( const unsigned int  i)
inline

Set the index of the line.

Parameters
i: The index number

Definition at line 219 of file vpMbtDistanceLine.h.

Referenced by vpMbtFaceDepthDense::addLine(), vpMbtFaceDepthNormal::addLine(), vpMbEdgeTracker::addLine(), and vpMbTracker::addProjectionErrorLine().

void vpMbtDistanceLine::setMeanWeight ( const double  w_mean)
inline

Set the mean weight of the line.

Parameters
w_mean: The mean weight of the line.

Definition at line 226 of file vpMbtDistanceLine.h.

Referenced by vpMbEdgeKltTracker::postTrackingMbt(), and vpMbEdgeTracker::updateMovingEdgeWeights().

void vpMbtDistanceLine::setMovingEdge ( vpMe _me)

Set the moving edge parameters.

Parameters
_me: an instance of vpMe containing all the desired parameters

Definition at line 282 of file vpMbtDistanceLine.cpp.

References meline.

Referenced by vpMbEdgeTracker::addLine(), vpMbTracker::addProjectionErrorLine(), vpMbEdgeTracker::setMovingEdge(), and vpMbTracker::setProjectionErrorMovingEdge().

void vpMbtDistanceLine::setName ( const std::string &  line_name)
inline

Set the name of the line.

Parameters
line_name: The name of the line.

Definition at line 235 of file vpMbtDistanceLine.h.

Referenced by vpMbtFaceDepthDense::addLine(), vpMbtFaceDepthNormal::addLine(), vpMbEdgeTracker::addLine(), and vpMbTracker::addProjectionErrorLine().

void vpMbtDistanceLine::setName ( const char *  line_name)
inline

Set the name of the line.

Parameters
line_name: The name of the line.

Definition at line 242 of file vpMbtDistanceLine.h.

void vpMbtDistanceLine::setTracked ( const std::string &  polyname,
const bool &  track 
)

Set if the line has to considered during tracking phase. Line won't be considered if all of its polygons are desactivated.

Parameters
polyname: name of the polygons that have to be modified.
track: True if the polygon has to be tracked, False otherwise.

Definition at line 229 of file vpMbtDistanceLine.cpp.

References hiddenface, Lindex_polygon, Lindex_polygon_tracked, and updateTracked().

void vpMbtDistanceLine::setVisible ( bool  _isvisible)
inline

Set a boolean parameter to indicates if the line is visible in the image or not.

Parameters
_isvisible: Set to true if the line is visible

Definition at line 252 of file vpMbtDistanceLine.h.

Referenced by vpMbtFaceDepthDense::computeVisibilityDisplay(), vpMbtFaceDepthNormal::computeVisibilityDisplay(), vpMbEdgeTracker::initMovingEdge(), and vpMbTracker::projectionErrorInitMovingEdge().

void vpMbtDistanceLine::trackMovingEdge ( const vpImage< unsigned char > &  I)

Track the moving edges in the image.

Parameters
I: the image.

Definition at line 415 of file vpMbtDistanceLine.cpp.

References isvisible, meline, nbFeature, nbFeatureTotal, and Reinit.

Referenced by vpMbEdgeTracker::trackMovingEdge().

void vpMbtDistanceLine::updateTracked ( )

Update the boolean specifying if the line has to be tracked. It takes into account the desactivated polygons and the visibility of the others.

Definition at line 259 of file vpMbtDistanceLine.cpp.

References hiddenface, Lindex_polygon, and Lindex_polygon_tracked.

Referenced by vpMbEdgeTracker::initMovingEdge(), vpMbTracker::projectionErrorInitMovingEdge(), and setTracked().

Member Data Documentation

bool vpMbtDistanceLine::isvisible
std::vector<bool> vpMbtDistanceLine::Lindex_polygon_tracked

Vector of bool associated with Lindex_polygon to know if Lindex_polygon[i] is tracked

Definition at line 109 of file vpMbtDistanceLine.h.

Referenced by addPolygon(), setTracked(), and updateTracked().

vpLine* vpMbtDistanceLine::line