Visual Servoing Platform  version 3.6.1 under development (2024-10-10)
vpMbtDistanceCircle Class Reference

#include <visp3/mbt/vpMbtDistanceCircle.h>

Public Member Functions

 vpMbtDistanceCircle ()
 
virtual ~vpMbtDistanceCircle ()
 
void buildFrom (const vpPoint &_p1, const vpPoint &_p2, const vpPoint &_p3, double r)
 
void computeInteractionMatrixError (const vpHomogeneousMatrix &cMo)
 
void display (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, unsigned int thickness=1, bool displayFullModel=false)
 
void display (const vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, unsigned int thickness=1, bool displayFullModel=false)
 
void displayMovingEdges (const vpImage< unsigned char > &I)
 
void displayMovingEdges (const vpImage< vpRGBa > &I)
 
void getCameraParameters (vpCameraParameters &camera)
 
unsigned int getIndex ()
 
double getMeanWeight () const
 
std::vector< std::vector< double > > getFeaturesForDisplay ()
 
std::vector< double > getModelForDisplay (const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, bool displayFullModel=false)
 
std::string getName () const
 
void initInteractionMatrixError ()
 
bool initMovingEdge (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, bool doNotTrack, const vpImage< bool > *mask=nullptr)
 
bool isTracked () const
 
bool isVisible () const
 
void reinitMovingEdge (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpImage< bool > *mask=nullptr)
 
void setCameraParameters (const vpCameraParameters &camera)
 
void setTracked (const bool &track)
 
void setIndex (unsigned int i)
 
void setMeanWeight (double _wmean)
 
void setMovingEdge (vpMe *Me)
 
void setName (const std::string &circle_name)
 
void setName (const char *circle_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

vpMbtMeEllipse * meEllipse
 
vpCirclecircle
 
double radius
 
vpPointp1
 
vpPointp2
 
vpPointp3
 
vpMatrix L
 
vpColVector error
 
unsigned int nbFeature
 
bool Reinit
 
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
 
int index_polygon
 
bool isvisible
 

Detailed Description

Manage a circle used in the model-based tracker.

Definition at line 60 of file vpMbtDistanceCircle.h.

Constructor & Destructor Documentation

◆ vpMbtDistanceCircle()

BEGIN_VISP_NAMESPACE vpMbtDistanceCircle::vpMbtDistanceCircle ( )

Basic constructor

Definition at line 59 of file vpMbtDistanceCircle.cpp.

◆ ~vpMbtDistanceCircle()

vpMbtDistanceCircle::~vpMbtDistanceCircle ( )
virtual

Basic destructor useful to deallocate the memory.

Definition at line 68 of file vpMbtDistanceCircle.cpp.

References circle, meEllipse, p1, p2, and p3.

Member Function Documentation

◆ buildFrom()

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

Build a vpMbtDistanceCircle thanks to its center, 3 points (including the center) with coordinates expressed in the object frame and defining the plane that contain the circle and its radius.

Parameters
_p1: Center of the circle.
_p2,_p3: Two points on the plane containing the circle. With the center of the circle we have 3 points defining the plane that contains the circle.
r: Radius of the circle.

Definition at line 100 of file vpMbtDistanceCircle.cpp.

References circle, vpPoint::get_oX(), vpPoint::get_oY(), vpPoint::get_oZ(), vpPlane::getA(), vpPlane::getB(), vpPlane::getC(), vpPlane::object_frame, p1, p2, p3, radius, and vpCircle::setWorldCoordinates().

Referenced by vpMbEdgeTracker::addCircle(), and vpMbTracker::addProjectionErrorCircle().

◆ computeInteractionMatrixError()

void vpMbtDistanceCircle::computeInteractionMatrixError ( const vpHomogeneousMatrix cMo)

◆ display() [1/2]

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

Display the circle. The 3D circle is projected into the image as an ellipse.

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. If false, display the circle only if visible.

Definition at line 276 of file vpMbtDistanceCircle.cpp.

References vpDisplay::displayEllipse(), and getModelForDisplay().

◆ display() [2/2]

void vpMbtDistanceCircle::display ( const vpImage< vpRGBa > &  I,
const vpHomogeneousMatrix cMo,
const vpCameraParameters camera,
const vpColor col,
unsigned int  thickness = 1,
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. If false, display the circle only if visible.

Definition at line 300 of file vpMbtDistanceCircle.cpp.

References vpDisplay::displayEllipse(), and getModelForDisplay().

◆ displayMovingEdges() [1/2]

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

Enable to display the points along the ellipse 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 blue : The point is removed because of the robust method in the virtual visual servoing.
Parameters
I: The image.

Definition at line 397 of file vpMbtDistanceCircle.cpp.

References vpDisplay::flush(), and meEllipse.

◆ displayMovingEdges() [2/2]

void vpMbtDistanceCircle::displayMovingEdges ( const vpImage< vpRGBa > &  I)

Definition at line 406 of file vpMbtDistanceCircle.cpp.

References vpDisplay::flush(), and meEllipse.

◆ getCameraParameters()

void vpMbtDistanceCircle::getCameraParameters ( vpCameraParameters camera)
inline

Get the camera parameters.

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

Definition at line 144 of file vpMbtDistanceCircle.h.

◆ getFeaturesForDisplay()

std::vector< std::vector< double > > vpMbtDistanceCircle::getFeaturesForDisplay ( )

Return a list of features parameters for display.

  • Parameters are: <feature id (here 0 for ME)>, <pt.i()>, <pt.j()>, <state>

Definition at line 317 of file vpMbtDistanceCircle.cpp.

References vpMeSite::get_ifloat(), vpMeSite::get_jfloat(), vpMeSite::getState(), and meEllipse.

Referenced by vpMbEdgeTracker::getFeaturesForDisplayEdge().

◆ getIndex()

unsigned int vpMbtDistanceCircle::getIndex ( )
inline

Get the index of the circle.

Returns
Return the index of the line.

Definition at line 151 of file vpMbtDistanceCircle.h.

◆ getMeanWeight()

double vpMbtDistanceCircle::getMeanWeight ( ) const
inline

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

Definition at line 160 of file vpMbtDistanceCircle.h.

◆ getModelForDisplay()

std::vector< double > vpMbtDistanceCircle::getModelForDisplay ( const vpHomogeneousMatrix cMo,
const vpCameraParameters camera,
bool  displayFullModel = false 
)

Return a list of ellipse parameters to display the primitive at a given pose and camera parameters.

  • Parameters are: <primitive id (here 1 for ellipse)>, <pt_center.i()>, <pt_center.j()>, <n20>, <n11>, <n02> which are respectively the ellipse centroid coordinates and second order centered moments of the ellipse normalized by its area (i.e., such that $n_{ij} = \mu_{ij}/a$ where $\mu_{ij}$ are the centered moments and a the area).
Parameters
cMo: Pose used to project the 3D model into the image.
camera: The camera parameters.
displayFullModel: If true, the line is displayed even if it is not

Definition at line 356 of file vpMbtDistanceCircle.cpp.

References vpCircle::changeFrame(), circle, vpMeterPixelConversion::convertEllipse(), vpImagePoint::get_i(), vpImagePoint::get_j(), isvisible, and vpCircle::projection().

Referenced by display().

◆ getName()

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

Get the name of the circle.

Returns
Return the name of the circle.

Definition at line 172 of file vpMbtDistanceCircle.h.

Referenced by vpMbEdgeTracker::removeCircle().

◆ initInteractionMatrixError()

void vpMbtDistanceCircle::initInteractionMatrixError ( )

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

Definition at line 418 of file vpMbtDistanceCircle.cpp.

References error, isvisible, L, meEllipse, nbFeature, vpColVector::resize(), and vpArray2D< Type >::resize().

Referenced by vpMbEdgeTracker::initMbtTracking().

◆ initMovingEdge()

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

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

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 nullptr 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 145 of file vpMbtDistanceCircle.cpp.

References vpCircle::changeFrame(), circle, vpMeterPixelConversion::convertEllipse(), vpMe::getRange(), isvisible, meEllipse, and vpCircle::projection().

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

◆ isTracked()

◆ isVisible()

bool vpMbtDistanceCircle::isVisible ( ) const
inline

◆ reinitMovingEdge()

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

Reinitialize the circle if it is required.

A circle is reinitialized if the ellipse do not match enough with the projected 3D circle.

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

Definition at line 251 of file vpMbtDistanceCircle.cpp.

References initMovingEdge(), meEllipse, and Reinit.

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

◆ setCameraParameters()

void vpMbtDistanceCircle::setCameraParameters ( const vpCameraParameters camera)
inline

Set the camera parameters.

Parameters
camera: The camera parameters.

Definition at line 200 of file vpMbtDistanceCircle.h.

Referenced by vpMbEdgeTracker::addCircle(), vpMbTracker::addProjectionErrorCircle(), and vpMbTracker::computeProjectionErrorImpl().

◆ setIndex()

void vpMbtDistanceCircle::setIndex ( unsigned int  i)
inline

Set the index of the circle.

Parameters
i: The index number

Definition at line 214 of file vpMbtDistanceCircle.h.

Referenced by vpMbEdgeTracker::addCircle(), and vpMbTracker::addProjectionErrorCircle().

◆ setMeanWeight()

void vpMbtDistanceCircle::setMeanWeight ( double  _wmean)
inline

Set the mean weight of the circle.

Parameters
_wmean: The mean weight of the circle.

Definition at line 221 of file vpMbtDistanceCircle.h.

Referenced by vpMbEdgeTracker::updateMovingEdgeWeights().

◆ setMovingEdge()

void vpMbtDistanceCircle::setMovingEdge ( vpMe _me)

Set the moving edge parameters.

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

Definition at line 126 of file vpMbtDistanceCircle.cpp.

References meEllipse.

Referenced by vpMbEdgeTracker::addCircle(), vpMbTracker::addProjectionErrorCircle(), vpMbEdgeTracker::setMovingEdge(), and vpMbTracker::setProjectionErrorMovingEdge().

◆ setName() [1/2]

void vpMbtDistanceCircle::setName ( const char *  circle_name)
inline

Set the name of the circle.

Parameters
circle_name: The name of the circle.

Definition at line 237 of file vpMbtDistanceCircle.h.

◆ setName() [2/2]

void vpMbtDistanceCircle::setName ( const std::string &  circle_name)
inline

Set the name of the circle.

Parameters
circle_name: The name of the circle.

Definition at line 230 of file vpMbtDistanceCircle.h.

Referenced by vpMbEdgeTracker::addCircle(), and vpMbTracker::addProjectionErrorCircle().

◆ setTracked()

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

Set if the circle has to considered during tracking phase.

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

Definition at line 207 of file vpMbtDistanceCircle.h.

◆ setVisible()

void vpMbtDistanceCircle::setVisible ( bool  _isvisible)
inline

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

Parameters
_isvisible: Set to true if the circle is visible

Definition at line 245 of file vpMbtDistanceCircle.h.

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

◆ trackMovingEdge()

void vpMbtDistanceCircle::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 188 of file vpMbtDistanceCircle.cpp.

References isvisible, meEllipse, nbFeature, and Reinit.

Referenced by vpMbEdgeTracker::trackMovingEdge().

◆ updateMovingEdge()

void vpMbtDistanceCircle::updateMovingEdge ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo 
)

Update the moving edges internal parameters.

Warning
: Not implemented.
Parameters
I: the image.
cMo: The pose of the camera.

Definition at line 213 of file vpMbtDistanceCircle.cpp.

References vpCircle::changeFrame(), circle, vpMeterPixelConversion::convertEllipse(), isvisible, meEllipse, nbFeature, vpCircle::projection(), and Reinit.

Referenced by vpMbEdgeTracker::updateMovingEdge().

Member Data Documentation

◆ circle

vpCircle* vpMbtDistanceCircle::circle

◆ error

◆ hiddenface

◆ index_polygon

int vpMbtDistanceCircle::index_polygon

◆ isvisible

bool vpMbtDistanceCircle::isvisible

Indicates if the circle is visible or not.

Definition at line 104 of file vpMbtDistanceCircle.h.

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

◆ L

◆ meEllipse

◆ nbFeature

◆ p1

vpPoint* vpMbtDistanceCircle::p1

The center of the circle.

Definition at line 85 of file vpMbtDistanceCircle.h.

Referenced by vpMbEdgeTracker::addCircle(), vpMbTracker::addProjectionErrorCircle(), buildFrom(), and ~vpMbtDistanceCircle().

◆ p2

vpPoint* vpMbtDistanceCircle::p2

A point on the plane containing the circle.

Definition at line 87 of file vpMbtDistanceCircle.h.

Referenced by vpMbEdgeTracker::addCircle(), vpMbTracker::addProjectionErrorCircle(), buildFrom(), and ~vpMbtDistanceCircle().

◆ p3

vpPoint* vpMbtDistanceCircle::p3

An other point on the plane containing the circle.

Definition at line 89 of file vpMbtDistanceCircle.h.

Referenced by vpMbEdgeTracker::addCircle(), vpMbTracker::addProjectionErrorCircle(), buildFrom(), and ~vpMbtDistanceCircle().

◆ radius

double vpMbtDistanceCircle::radius

The radius of the circle.

Definition at line 82 of file vpMbtDistanceCircle.h.

Referenced by vpMbEdgeTracker::addCircle(), vpMbTracker::addProjectionErrorCircle(), and buildFrom().

◆ Reinit

bool vpMbtDistanceCircle::Reinit