ViSP
2.7.0
|
#include <vpMbtKltPolygon.h>
Public Member Functions | |
vpMbtKltPolygon () | |
virtual | ~vpMbtKltPolygon () |
unsigned int | computeNbDetectedCurrent (const vpKltOpencv &_tracker) |
void | computeHomography (const vpHomogeneousMatrix &_cTc0, vpHomography &cHc0) |
void | computeInteractionMatrixAndResidu (vpColVector &_R, vpMatrix &_J) |
void | displayPrimitive (const vpImage< unsigned char > &_I) |
void | displayPrimitive (const vpImage< vpRGBa > &_I) |
vpCameraParameters & | getCameraParameters () |
vpColVector | getCurrentNormal () const |
std::map< int, vpImagePoint > & | getCurrentPoints () |
std::map< int, int > & | getCurrentPointsInd () |
vpImagePoint & | getImagePoint (const unsigned int _index) |
unsigned int | getInitialNumberPoint () const |
unsigned int | getNbPointsCur () const |
bool | hasEnoughPoints () const |
void | init (const vpKltOpencv &_tracker) |
void | removeOutliers (const vpColVector &weight, const double &threshold_outlier) |
virtual void | setCameraParameters (const vpCameraParameters &_cam) |
void | updateMask (IplImage *_mask, unsigned int _nb=255, unsigned int _shiftBorder=0) |
void | addPoint (const unsigned int n, const vpPoint &P) |
void | changeFrame (const vpHomogeneousMatrix &cMo) |
int | getIndex () const |
unsigned int | getNbPoint () const |
vpPoint & | getPoint (const unsigned int _index) |
std::vector< vpImagePoint > | getRoi (const vpCameraParameters &_cam) |
bool | isAppearing () const |
bool | isVisible (const vpHomogeneousMatrix &cMo, const bool &depthTest=false) |
virtual bool | isVisible (const vpHomogeneousMatrix &cMo, const double alpha) |
bool | isVisible () const |
virtual void | setIndex (const int i) |
virtual void | setNbPoint (const unsigned int nb) |
Static Public Member Functions | |
static void | getMinMaxRoi (const std::vector< vpImagePoint > &roi, int &i_min, int &i_max, int &j_min, int &j_max) |
static bool | roiInsideImage (const vpImage< unsigned char > &I, const std::vector< vpImagePoint > &corners) |
Public Attributes | |
int | index |
unsigned int | nbpt |
bool | isvisible |
bool | isappearing |
vpPoint * | p |
Implementation of a polygon of the model containing points of interest. It is used by the model-based tracker KLT, and hybrid.
Definition at line 63 of file vpMbtKltPolygon.h.
vpMbtKltPolygon::vpMbtKltPolygon | ( | ) |
Basic constructor.
Definition at line 48 of file vpMbtKltPolygon.cpp.
References vpMbtPolygon::isvisible.
|
virtual |
Basic destructor.
Definition at line 66 of file vpMbtKltPolygon.cpp.
|
inherited |
Add a corner point to the list of polygon's corners.
n | : The index of the corner. |
P | : The point to add. |
Definition at line 115 of file vpMbtPolygon.cpp.
References vpMbtPolygon::p.
Referenced by vpMbKltTracker::initFaceFromCorners(), and vpMbEdgeTracker::initFaceFromCorners().
|
inherited |
Project the 3D corner points into the image thanks to the pose of the camera.
cMo | : The pose of the camera. |
Definition at line 127 of file vpMbtPolygon.cpp.
References vpPoint::changeFrame(), vpMbtPolygon::nbpt, vpMbtPolygon::p, and vpPoint::projection().
Referenced by vpMbtPolygon::isVisible().
void vpMbtKltPolygon::computeHomography | ( | const vpHomogeneousMatrix & | _cTc0, |
vpHomography & | _cHc0 | ||
) |
compute the homography using a displacement matrix.
the homography is given by:
Several internal variables are computed (dt, cRc0_0n)
_cTc0 | : the displacement matrix of the camera between the initial position of the camera and the current camera position |
_cHc0 | : the homography of the plane |
Definition at line 242 of file vpMbtKltPolygon.cpp.
References vpHomogeneousMatrix::extract().
void vpMbtKltPolygon::computeInteractionMatrixAndResidu | ( | 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.
_R | : the residu vector |
_J | : the interaction matrix |
Definition at line 153 of file vpMbtKltPolygon.cpp.
References vpPixelMeterConversion::convertPoint(), and vpMbtPolygon::index.
unsigned int vpMbtKltPolygon::computeNbDetectedCurrent | ( | const vpKltOpencv & | _tracker | ) |
compute the number of point in this instanciation of the tracker that corresponds to the points of the face
_tracker | : the KLT tracker |
Definition at line 119 of file vpMbtKltPolygon.cpp.
References vpKltOpencv::getFeature(), and vpKltOpencv::getNbFeatures().
void vpMbtKltPolygon::displayPrimitive | ( | const vpImage< unsigned char > & | _I | ) |
Display the primitives tracked for the face.
_I | : The image where to display. |
Definition at line 412 of file vpMbtKltPolygon.cpp.
References vpDisplay::displayCharString(), vpDisplay::displayCross(), vpImagePoint::get_i(), vpImagePoint::get_j(), vpColor::red, vpMath::round(), vpImagePoint::set_i(), and vpImagePoint::set_j().
Display the primitives tracked for the face.
_I | : The image where to display. |
Definition at line 437 of file vpMbtKltPolygon.cpp.
References vpDisplay::displayCharString(), vpDisplay::displayCross(), vpImagePoint::get_i(), vpImagePoint::get_j(), vpColor::red, vpMath::round(), vpImagePoint::set_i(), and vpImagePoint::set_j().
|
inline |
Get the camera parameters of the face.
Definition at line 119 of file vpMbtKltPolygon.h.
|
inline |
Definition at line 121 of file vpMbtKltPolygon.h.
|
inline |
Definition at line 123 of file vpMbtKltPolygon.h.
|
inline |
Definition at line 125 of file vpMbtKltPolygon.h.
vpImagePoint& vpMbtKltPolygon::getImagePoint | ( | const unsigned int | _index | ) |
|
inlineinherited |
Get the index of the face.
Definition at line 94 of file vpMbtPolygon.h.
|
inline |
Get the number of point that was belonging to the face at the initialisation
Definition at line 133 of file vpMbtKltPolygon.h.
|
staticinherited |
Definition at line 285 of file vpMbtPolygon.cpp.
Referenced by updateMask().
|
inlineinherited |
Return the number of corners.
Definition at line 101 of file vpMbtPolygon.h.
Referenced by vpMbEdgeTracker::addPolygon().
|
inline |
get the number of points detected in the last image.
Definition at line 143 of file vpMbtKltPolygon.h.
|
inherited |
Get a reference to a corner.
vpException::dimensionError | if the _index is out of range. |
_index | : the index of the corner |
Definition at line 86 of file vpMbtPolygon.cpp.
References vpException::dimensionError, vpMbtPolygon::nbpt, and vpMbtPolygon::p.
|
inherited |
Definition at line 269 of file vpMbtPolygon.cpp.
References vpMeterPixelConversion::convertPoint(), vpMbtPolygon::nbpt, and vpMbtPolygon::p.
Referenced by init(), and updateMask().
|
inline |
Definition at line 145 of file vpMbtKltPolygon.h.
void vpMbtKltPolygon::init | ( | const vpKltOpencv & | _tracker | ) |
Initialise the face 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. |
Definition at line 77 of file vpMbtKltPolygon.cpp.
References vpPlane::getD(), vpKltOpencv::getFeature(), vpKltOpencv::getNbFeatures(), vpPlane::getNormal(), vpMbtPolygon::getRoi(), vpColVector::normalize(), and vpMbtPolygon::p.
|
inlineinherited |
Definition at line 107 of file vpMbtPolygon.h.
|
inherited |
Check if the polygon is visible in the image. To do that, the polygon is projected into the image thanks to the camera pose.
cMo | : The pose of the camera. |
depthTest | : True if a face has to be entirely visible (in front of the camera). False if it can be partially visible. |
Definition at line 145 of file vpMbtPolygon.cpp.
References vpMbtPolygon::changeFrame(), vpColVector::crossProd(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), vpMbtPolygon::isappearing, vpMbtPolygon::isvisible, vpMbtPolygon::nbpt, and vpMbtPolygon::p.
|
virtualinherited |
Check if the polygon is visible in the image and if the angle between the normal to the face and the normal to the camera plane is below the given threshold. To do that, the polygon is projected into the image thanks to the camera pose.
cMo | : The pose of the camera. |
alpha | : maximum angle to detect if the face is visible (in rad) |
Definition at line 212 of file vpMbtPolygon.cpp.
References vpMbtPolygon::changeFrame(), vpColVector::crossProd(), vpColVector::dotProd(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), vpMbtPolygon::isappearing, vpMbtPolygon::isvisible, vpMbtPolygon::nbpt, vpColVector::normalize(), vpMbtPolygon::p, vpPoint::set_X(), vpPoint::set_Y(), and vpPoint::set_Z().
|
inlineinherited |
Definition at line 110 of file vpMbtPolygon.h.
void vpMbtKltPolygon::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 371 of file vpMbtKltPolygon.cpp.
|
staticinherited |
Static method to check whether the region defined by the vector of image point is contained entirely in the image.
I | : The image used for its size. |
corners | : The vector of points defining a region |
Definition at line 326 of file vpMbtPolygon.cpp.
References vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().
|
inlinevirtual |
Set the camera parameters
_cam | : the new camera parameters |
Definition at line 156 of file vpMbtKltPolygon.h.
|
inlinevirtualinherited |
Set the index of the face.
i | : the new index of the face. |
Definition at line 117 of file vpMbtPolygon.h.
Referenced by vpMbEdgeTracker::addPolygon(), vpMbKltTracker::initFaceFromCorners(), and vpMbEdgeTracker::initFaceFromCorners().
|
virtualinherited |
Set the number of points which are the corners of the polygon.
nb | : The number of corners. |
Definition at line 100 of file vpMbtPolygon.cpp.
References vpMbtPolygon::nbpt, and vpMbtPolygon::p.
Referenced by vpMbKltTracker::initFaceFromCorners(), and vpMbEdgeTracker::initFaceFromCorners().
void vpMbtKltPolygon::updateMask | ( | IplImage * | _mask, |
unsigned int | _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 312 of file vpMbtKltPolygon.cpp.
References vpMbtPolygon::getMinMaxRoi(), and vpMbtPolygon::getRoi().
|
inherited |
Index of the polygon. Cannot be unsigned int because deafult value is -1.
Definition at line 71 of file vpMbtPolygon.h.
Referenced by computeInteractionMatrixAndResidu().
|
inherited |
flag to specify whether the face is appearing or not
Definition at line 77 of file vpMbtPolygon.h.
Referenced by vpMbtPolygon::isVisible(), and vpMbtPolygon::vpMbtPolygon().
|
inherited |
flag to specify whether the face is visible or not
Definition at line 75 of file vpMbtPolygon.h.
Referenced by vpMbtPolygon::isVisible(), vpMbtKltPolygon(), and vpMbtPolygon::vpMbtPolygon().
|
inherited |
Number of points used to define the polygon.
Definition at line 73 of file vpMbtPolygon.h.
Referenced by vpMbtPolygon::changeFrame(), vpMbtPolygon::getPoint(), vpMbtPolygon::getRoi(), vpMbtPolygon::isVisible(), vpMbtPolygon::setNbPoint(), and vpMbtPolygon::vpMbtPolygon().
|
inherited |
corners in the object frame
Definition at line 79 of file vpMbtPolygon.h.
Referenced by vpMbtPolygon::addPoint(), vpMbEdgeTracker::addPolygon(), vpMbtPolygon::changeFrame(), vpMbtPolygon::getPoint(), vpMbtPolygon::getRoi(), init(), vpMbtPolygon::isVisible(), vpMbtPolygon::setNbPoint(), vpMbtPolygon::vpMbtPolygon(), and vpMbtPolygon::~vpMbtPolygon().