Visual Servoing Platform  version 3.0.0
vpMbtDistanceCylinder Class Reference

#include <visp3/mbt/vpMbtDistanceCylinder.h>

Public Member Functions

 vpMbtDistanceCylinder ()
 
 ~vpMbtDistanceCylinder ()
 
void buildFrom (const vpPoint &_p1, const vpPoint &_p2, const double r)
 
void computeInteractionMatrixError (const vpHomogeneousMatrix &cMo, const vpImage< unsigned char > &I)
 
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)
 
unsigned int getIndex ()
 
double getMeanWeight1 () const
 
double getMeanWeight2 () const
 
std::string getName () const
 
void initInteractionMatrixError ()
 
bool initMovingEdge (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
 
bool isTracked () const
 
bool isVisible () const
 
void reinitMovingEdge (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
 
void setCameraParameters (const vpCameraParameters &camera)
 
void setTracked (const bool &track)
 
void setIndex (const unsigned int i)
 
void setMeanWeight1 (const double wmean)
 
void setMeanWeight2 (const double wmean)
 
void setMovingEdge (vpMe *Me)
 
void setName (const std::string &cyl_name)
 
void setName (const char *cyl_name)
 
void setVisible (bool _isvisible)
 
void trackMovingEdge (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
 
void updateMovingEdge (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
 

Public Attributes

vpMbtMeLine * meline1
 
vpMbtMeLine * meline2
 
vpCirclecercle1
 
vpCirclecercle2
 
double radius
 
vpPointp1
 
vpPointp2
 
vpMatrix L
 
vpColVector error
 
unsigned int nbFeature
 
unsigned int nbFeaturel1
 
unsigned int nbFeaturel2
 
bool Reinit
 
vpCylinderc
 
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
 
int index_polygon
 
bool isvisible
 

Detailed Description

Manage a cylinder used in the model-based tracker.

Definition at line 65 of file vpMbtDistanceCylinder.h.

Constructor & Destructor Documentation

vpMbtDistanceCylinder::vpMbtDistanceCylinder ( )

Basic constructor

Definition at line 63 of file vpMbtDistanceCylinder.cpp.

vpMbtDistanceCylinder::~vpMbtDistanceCylinder ( )

Basic destructor useful to deallocate the memory.

Definition at line 75 of file vpMbtDistanceCylinder.cpp.

References c, cercle1, cercle2, meline1, meline2, p1, and p2.

Member Function Documentation

void vpMbtDistanceCylinder::buildFrom ( const vpPoint _p1,
const vpPoint _p2,
const double  r 
)

Build a vpMbtDistanceCylinder thanks to two points corresponding to the extremities of its axis and its radius.

Parameters
_p1: The first extremity on the axis.
_p2: The second extremity on the axis.
r: Radius of the cylinder.

Definition at line 112 of file vpMbtDistanceCylinder.cpp.

References c, cercle1, cercle2, vpPoint::get_oX(), vpPoint::get_oY(), vpPoint::get_oZ(), p1, p2, radius, vpCircle::setWorldCoordinates(), and vpCylinder::setWorldCoordinates().

Referenced by vpMbEdgeTracker::addCylinder().

void vpMbtDistanceCylinder::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 cylinder. The 3D cylinder 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 lines.
displayFullModel: When true, display the circle even if non visible.

Definition at line 459 of file vpMbtDistanceCylinder.cpp.

References c, cercle1, cercle2, vpPoint::changeFrame(), vpCircle::changeFrame(), vpCylinder::changeFrame(), vpCircle::computeIntersectionPoint(), vpMeterPixelConversion::convertLine(), vpDisplay::displayLine(), vpCylinder::getRho1(), vpCylinder::getRho2(), vpCylinder::getTheta1(), vpCylinder::getTheta2(), isvisible, p1, p2, vpCircle::projection(), vpPoint::projection(), vpCylinder::projection(), and vpImagePoint::set_ij().

void vpMbtDistanceCylinder::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 cylinder. The 3D cylinder 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 lines.
displayFullModel: When true, display the circle even if non visible.

Definition at line 523 of file vpMbtDistanceCylinder.cpp.

References c, cercle1, cercle2, vpPoint::changeFrame(), vpCircle::changeFrame(), vpCylinder::changeFrame(), vpCircle::computeIntersectionPoint(), vpMeterPixelConversion::convertLine(), vpDisplay::displayLine(), vpCylinder::getRho1(), vpCylinder::getRho2(), vpCylinder::getTheta1(), vpCylinder::getTheta2(), isvisible, p1, p2, vpCircle::projection(), vpPoint::projection(), vpCylinder::projection(), and vpImagePoint::set_ij().

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

Enable to display the points along the lines 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 588 of file vpMbtDistanceCylinder.cpp.

References meline1, and meline2.

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

void vpMbtDistanceCylinder::getCameraParameters ( vpCameraParameters camera)
inline

Get the camera paramters.

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

Definition at line 153 of file vpMbtDistanceCylinder.h.

unsigned int vpMbtDistanceCylinder::getIndex ( )
inline

Get the index of the cylinder.

Returns
Return the index of the line.

Definition at line 160 of file vpMbtDistanceCylinder.h.

double vpMbtDistanceCylinder::getMeanWeight1 ( ) const
inline

Get the mean weight of the first 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 first line.

Definition at line 168 of file vpMbtDistanceCylinder.h.

double vpMbtDistanceCylinder::getMeanWeight2 ( ) const
inline

Get the mean weight of the second 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 second line.

Definition at line 176 of file vpMbtDistanceCylinder.h.

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

Get the name of the cylinder.

Returns
Return the name of the cylinder

Definition at line 183 of file vpMbtDistanceCylinder.h.

Referenced by vpMbEdgeTracker::removeCylinder().

void vpMbtDistanceCylinder::initInteractionMatrixError ( )

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

Definition at line 604 of file vpMbtDistanceCylinder.cpp.

References error, isvisible, L, meline1, meline2, nbFeature, nbFeaturel1, nbFeaturel2, vpArray2D< Type >::resize(), and vpColVector::resize().

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

bool vpMbtDistanceCylinder::initMovingEdge ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo 
)

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 lines.

Parameters
I: The image.
cMo: The pose of the camera used to initialize the moving edges.
Returns
false if an error occur, true otherwise.

Definition at line 178 of file vpMbtDistanceCylinder.cpp.

References c, cercle1, cercle2, vpPoint::changeFrame(), vpCircle::changeFrame(), vpCylinder::changeFrame(), vpCircle::computeIntersectionPoint(), vpMeterPixelConversion::convertLine(), vpImagePoint::get_i(), vpImagePoint::get_j(), vpCylinder::getRho1(), vpCylinder::getRho2(), vpCylinder::getTheta1(), vpCylinder::getTheta2(), isvisible, meline1, meline2, p1, p2, vpCircle::projection(), vpPoint::projection(), vpCylinder::projection(), and vpImagePoint::set_ij().

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

bool vpMbtDistanceCylinder::isVisible ( ) const
inline
void vpMbtDistanceCylinder::reinitMovingEdge ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo 
)

Reinitialize the cylinder if it is required.

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

Parameters
I: the image.
cMo: The pose of the camera.

Definition at line 431 of file vpMbtDistanceCylinder.cpp.

References initMovingEdge(), meline1, meline2, and Reinit.

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

void vpMbtDistanceCylinder::setCameraParameters ( const vpCameraParameters camera)
inline

Set the camera paramters.

Parameters
camera: The camera parameters.

Definition at line 209 of file vpMbtDistanceCylinder.h.

Referenced by vpMbEdgeTracker::addCylinder().

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

Set the index of the cylinder.

Parameters
i: The index number

Definition at line 223 of file vpMbtDistanceCylinder.h.

Referenced by vpMbEdgeTracker::addCylinder().

void vpMbtDistanceCylinder::setMeanWeight1 ( const double  wmean)
inline

Set the mean weight of the first line.

Parameters
wmean: The mean weight of the first line.

Definition at line 230 of file vpMbtDistanceCylinder.h.

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

void vpMbtDistanceCylinder::setMeanWeight2 ( const double  wmean)
inline

Set the mean weight of the second line.

Parameters
wmean: The mean weight of the second line.

Definition at line 237 of file vpMbtDistanceCylinder.h.

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

void vpMbtDistanceCylinder::setMovingEdge ( vpMe _me)

Set the moving edge parameters.

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

Definition at line 156 of file vpMbtDistanceCylinder.cpp.

References meline1, and meline2.

Referenced by vpMbEdgeTracker::addCylinder(), and vpMbEdgeTracker::setMovingEdge().

void vpMbtDistanceCylinder::setName ( const std::string &  cyl_name)
inline

Set the name of the cylinder.

Parameters
cyl_name: The name of the cylinder.

Definition at line 246 of file vpMbtDistanceCylinder.h.

Referenced by vpMbEdgeTracker::addCylinder().

void vpMbtDistanceCylinder::setName ( const char *  cyl_name)
inline

Set the name of the cylinder.

Parameters
cyl_name: The name of the cylinder

Definition at line 253 of file vpMbtDistanceCylinder.h.

void vpMbtDistanceCylinder::setTracked ( const bool &  track)
inline

Set if the cylinder has to considered during tracking phase.

Parameters
track: True if the cylinder has to be tracked, False otherwise.

Definition at line 216 of file vpMbtDistanceCylinder.h.

void vpMbtDistanceCylinder::setVisible ( bool  _isvisible)
inline

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

Parameters
_isvisible: Set to true if the cylinder is visible

Definition at line 260 of file vpMbtDistanceCylinder.h.

Referenced by vpMbEdgeTracker::initMovingEdge().

void vpMbtDistanceCylinder::trackMovingEdge ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo 
)

Track the moving edges in the image.

Parameters
I: the image.
cMo: The pose of the camera.

Definition at line 289 of file vpMbtDistanceCylinder.cpp.

References isvisible, meline1, meline2, nbFeature, nbFeaturel1, nbFeaturel2, and Reinit.

Referenced by vpMbEdgeTracker::trackMovingEdge().

Member Data Documentation

vpCylinder* vpMbtDistanceCylinder::c
vpCircle* vpMbtDistanceCylinder::cercle1

The upper circle limiting the cylinder.

Definition at line 85 of file vpMbtDistanceCylinder.h.

Referenced by buildFrom(), computeInteractionMatrixError(), display(), initMovingEdge(), updateMovingEdge(), and ~vpMbtDistanceCylinder().

vpCircle* vpMbtDistanceCylinder::cercle2

The lower circle limiting the cylinder.

Definition at line 87 of file vpMbtDistanceCylinder.h.

Referenced by buildFrom(), computeInteractionMatrixError(), display(), initMovingEdge(), updateMovingEdge(), and ~vpMbtDistanceCylinder().

vpMbHiddenFaces<vpMbtPolygon>* vpMbtDistanceCylinder::hiddenface

Pointer to the list of faces.

Definition at line 113 of file vpMbtDistanceCylinder.h.

Referenced by vpMbEdgeTracker::addCylinder(), and vpMbEdgeTracker::initMovingEdge().

int vpMbtDistanceCylinder::index_polygon

Index of the face which contains the cylinder.

Definition at line 115 of file vpMbtDistanceCylinder.h.

Referenced by vpMbEdgeTracker::addCylinder(), and vpMbEdgeTracker::initMovingEdge().

bool vpMbtDistanceCylinder::isvisible

Indicates if the cylinder is visible or not.

Definition at line 117 of file vpMbtDistanceCylinder.h.

Referenced by computeInteractionMatrixError(), display(), initInteractionMatrixError(), initMovingEdge(), trackMovingEdge(), and updateMovingEdge().

vpMatrix vpMbtDistanceCylinder::L
unsigned int vpMbtDistanceCylinder::nbFeaturel1
unsigned int vpMbtDistanceCylinder::nbFeaturel2
vpPoint* vpMbtDistanceCylinder::p1

The first extremity on the axe.

Definition at line 93 of file vpMbtDistanceCylinder.h.

Referenced by vpMbEdgeTracker::addCylinder(), buildFrom(), display(), initMovingEdge(), updateMovingEdge(), and ~vpMbtDistanceCylinder().

vpPoint* vpMbtDistanceCylinder::p2

The second extremity on the axe.

Definition at line 95 of file vpMbtDistanceCylinder.h.

Referenced by vpMbEdgeTracker::addCylinder(), buildFrom(), display(), initMovingEdge(), updateMovingEdge(), and ~vpMbtDistanceCylinder().

double vpMbtDistanceCylinder::radius

The radius of the cylinder.

Definition at line 90 of file vpMbtDistanceCylinder.h.

Referenced by vpMbEdgeTracker::addCylinder(), and buildFrom().

bool vpMbtDistanceCylinder::Reinit