Visual Servoing Platform  version 3.1.0
vpMbtDistanceKltCylinder Class Reference

#include <visp3/mbt/vpMbtDistanceKltCylinder.h>

Public Member Functions

 vpMbtDistanceKltCylinder ()
virtual ~vpMbtDistanceKltCylinder ()
void buildFrom (const vpPoint &p1, const vpPoint &p2, const double &r)
unsigned int computeNbDetectedCurrent (const vpKltOpencv &_tracker)
void computeInteractionMatrixAndResidu (const vpHomogeneousMatrix &cMc0, vpColVector &_R, vpMatrix &_J)
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 displayPrimitive (const vpImage< unsigned char > &_I)
void displayPrimitive (const vpImage< vpRGBa > &_I)
vpCameraParametersgetCameraParameters ()
std::map< int, vpImagePoint > & getCurrentPoints ()
std::map< int, int > & getCurrentPointsInd ()
vpCylinder getCylinder () const
unsigned int getInitialNumberPoint () const
unsigned int getCurrentNumberPoints () const
bool hasEnoughPoints () const
bool isTracked () const
void init (const vpKltOpencv &_tracker, const vpHomogeneousMatrix &cMo)
void removeOutliers (const vpColVector &weight, const double &threshold_outlier)
virtual void setCameraParameters (const vpCameraParameters &_cam)
void setTracked (const bool &track)
void updateMask (cv::Mat &mask, unsigned char _nb=255, unsigned int _shiftBorder=0)

Public Attributes

std::vector< int > listIndicesCylinderBBox
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
bool useScanLine

Detailed Description

Implementation of a polygon of the model containing points of interest. It is used by the model-based tracker KLT, and hybrid.

This class is only available if OpenCV is installed, and used.

Definition at line 68 of file vpMbtDistanceKltCylinder.h.

Constructor & Destructor Documentation

◆ vpMbtDistanceKltCylinder()

vpMbtDistanceKltCylinder::vpMbtDistanceKltCylinder ( )

Basic constructor.

Definition at line 57 of file vpMbtDistanceKltCylinder.cpp.

◆ ~vpMbtDistanceKltCylinder()

vpMbtDistanceKltCylinder::~vpMbtDistanceKltCylinder ( )

Basic destructor.

Definition at line 68 of file vpMbtDistanceKltCylinder.cpp.

Member Function Documentation

◆ buildFrom()

void vpMbtDistanceKltCylinder::buildFrom ( const vpPoint p1,
const vpPoint p2,
const double &  r 

◆ computeInteractionMatrixAndResidu()

void vpMbtDistanceKltCylinder::computeInteractionMatrixAndResidu ( const vpHomogeneousMatrix _cMc0,
vpColVector _R,
vpMatrix _J 

Compute the interaction matrix and the residu vector for the face. The method assumes that these two objects are properly sized in order to be able to improve the speed with the use of SubCoVector and subMatrix.

The function preCompute must be called before the this method.
_cMc0: camera displacement since initialisation
_R: the residu vector
_J: the interaction matrix

Definition at line 281 of file vpMbtDistanceKltCylinder.cpp.

References vpPoint::changeFrame(), vpCylinder::changeFrame(), vpPixelMeterConversion::convertPoint(), vpPoint::get_x(), vpPoint::get_y(), vpMath::isNaN(), and vpForwardProjection::project().

Referenced by vpMbEdgeKltTracker::computeVVS(), and vpMbKltTracker::computeVVSInteractionMatrixAndResidu().

◆ computeNbDetectedCurrent()

unsigned int vpMbtDistanceKltCylinder::computeNbDetectedCurrent ( const vpKltOpencv _tracker)

compute the number of point in this instanciation of the tracker that corresponds to the points of the cylinder

_tracker: the KLT tracker
the number of points that are tracked in this face and in this instanciation of the tracker

Definition at line 196 of file vpMbtDistanceKltCylinder.cpp.

References vpKltOpencv::getFeature(), and vpKltOpencv::getNbFeatures().

Referenced by vpMbKltTracker::preTracking().

◆ display() [1/2]

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

◆ display() [2/2]

◆ displayPrimitive() [1/2]

void vpMbtDistanceKltCylinder::displayPrimitive ( const vpImage< unsigned char > &  _I)

◆ displayPrimitive() [2/2]

void vpMbtDistanceKltCylinder::displayPrimitive ( const vpImage< vpRGBa > &  _I)

Display the primitives tracked for the cylinder.

_I: The image where to display.

Definition at line 556 of file vpMbtDistanceKltCylinder.cpp.

References vpDisplay::displayCross(), vpDisplay::displayText(), vpImagePoint::get_i(), vpImagePoint::get_j(), vpColor::red, vpMath::round(), vpImagePoint::set_i(), and vpImagePoint::set_j().

◆ getCameraParameters()

vpCameraParameters& vpMbtDistanceKltCylinder::getCameraParameters ( )

Get the camera parameters of the face.

cam : the camera parameters of the face.

Definition at line 156 of file vpMbtDistanceKltCylinder.h.

◆ getCurrentNumberPoints()

unsigned int vpMbtDistanceKltCylinder::getCurrentNumberPoints ( ) const

Get the number of points detected in the last image.

To have the real number of points, the function computeNbDetectedCurrent() must be called first.
the number of points detected in the current image.
See also

Definition at line 183 of file vpMbtDistanceKltCylinder.h.

Referenced by vpMbEdgeKltTracker::computeVVS(), vpMbKltTracker::computeVVSInteractionMatrixAndResidu(), vpMbKltTracker::postTracking(), vpMbKltTracker::preTracking(), and vpMbKltTracker::testTracking().

◆ getCurrentPoints()

std::map<int, vpImagePoint>& vpMbtDistanceKltCylinder::getCurrentPoints ( )

Definition at line 158 of file vpMbtDistanceKltCylinder.h.

◆ getCurrentPointsInd()

std::map<int, int>& vpMbtDistanceKltCylinder::getCurrentPointsInd ( )

Definition at line 160 of file vpMbtDistanceKltCylinder.h.

◆ getCylinder()

vpCylinder vpMbtDistanceKltCylinder::getCylinder ( ) const

Definition at line 162 of file vpMbtDistanceKltCylinder.h.

◆ getInitialNumberPoint()

unsigned int vpMbtDistanceKltCylinder::getInitialNumberPoint ( ) const

Get the number of point that was belonging to the face at the initialisation

the number of initial point.
See also

Definition at line 172 of file vpMbtDistanceKltCylinder.h.

Referenced by vpMbKltTracker::postTracking().

◆ hasEnoughPoints()

◆ init()

void vpMbtDistanceKltCylinder::init ( const vpKltOpencv _tracker,
const vpHomogeneousMatrix cMo 

Initialise the cylinder to track. All the points in the map, representing all the map detected in the image, are parsed in order to extract the id of the points that are indeed in the face.

_tracker: ViSP OpenCV KLT Tracker.
cMo: Pose of the object in the camera frame at initialization.

Definition at line 106 of file vpMbtDistanceKltCylinder.cpp.

References vpCylinder::changeFrame(), vpPixelMeterConversion::convertPoint(), vpKltOpencv::getFeature(), vpMbHiddenFaces< PolygonType >::getMbScanLineRenderer(), vpKltOpencv::getNbFeatures(), vpMbHiddenFaces< PolygonType >::getPolygon(), hiddenface, vpPolygon::isInside(), vpMath::isNaN(), listIndicesCylinderBBox, vpPoint::setWorldCoordinates(), and useScanLine.

Referenced by vpMbKltTracker::reinit().

◆ isTracked()

◆ removeOutliers()

void vpMbtDistanceKltCylinder::removeOutliers ( const vpColVector _w,
const double &  threshold_outlier 

This method removes the outliers. A point is considered as outlier when its associated weight is below a given threshold (threshold_outlier).

_w: Vector containing the weight of all the tracked points.
threshold_outlier: Threshold to specify wether or not a point has to be deleted.

Definition at line 234 of file vpMbtDistanceKltCylinder.cpp.

Referenced by vpMbKltTracker::postTracking().

◆ setCameraParameters()

virtual void vpMbtDistanceKltCylinder::setCameraParameters ( const vpCameraParameters _cam)

Set the camera parameters

_cam: the new camera parameters

Definition at line 203 of file vpMbtDistanceKltCylinder.h.

Referenced by vpMbKltTracker::initCylinder(), and vpMbKltTracker::setCameraParameters().

◆ setTracked()

void vpMbtDistanceKltCylinder::setTracked ( const bool &  track)

Set if the klt cylinder has to be considered during tracking phase.

track: True if is has to be tracked, False otherwise.

Definition at line 210 of file vpMbtDistanceKltCylinder.h.

◆ updateMask()

void vpMbtDistanceKltCylinder::updateMask ( cv::Mat &  mask,
unsigned char  nb = 255,
unsigned int  shiftBorder = 0 

Modification of all the pixels that are in the roi to the value of _nb ( default is 255).

mask: the mask to update (0, not in the object, _nb otherwise).
nb: Optionnal value to set to the pixels included in the face.
shiftBorder: Optionnal shift for the border in pixel (sort of built-in erosion) to avoid to consider pixels near the limits of the face.

Definition at line 376 of file vpMbtDistanceKltCylinder.cpp.

References vpPolygon::buildFrom(), vpPolygon::getArea(), vpPolygon3D::getMinMaxRoi(), hiddenface, vpPolygon::isInside(), listIndicesCylinderBBox, and vpImagePoint::set_ij().

Referenced by vpMbKltTracker::reinit().

Member Data Documentation

◆ hiddenface

vpMbHiddenFaces<vpMbtPolygon>* vpMbtDistanceKltCylinder::hiddenface

Pointer to the list of faces.

Definition at line 108 of file vpMbtDistanceKltCylinder.h.

Referenced by init(), vpMbKltTracker::initCylinder(), and updateMask().

◆ listIndicesCylinderBBox

std::vector<int> vpMbtDistanceKltCylinder::listIndicesCylinderBBox

Pointer to the polygon that define a face.

Definition at line 106 of file vpMbtDistanceKltCylinder.h.

Referenced by init(), vpMbKltTracker::initCylinder(), vpMbKltTracker::reinit(), and updateMask().

◆ useScanLine

bool vpMbtDistanceKltCylinder::useScanLine

Use scanline rendering.

Definition at line 110 of file vpMbtDistanceKltCylinder.h.

Referenced by init(), and vpMbKltTracker::initCylinder().