ViSP
2.7.0
|
#include <vpMbtPolygon.h>
Public Member Functions | |
vpMbtPolygon () | |
virtual | ~vpMbtPolygon () |
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 used by the model-based tracker.
Definition at line 67 of file vpMbtPolygon.h.
vpMbtPolygon::vpMbtPolygon | ( | ) |
Basic constructor.
Definition at line 58 of file vpMbtPolygon.cpp.
References isappearing, isvisible, nbpt, and p.
|
virtual |
void vpMbtPolygon::addPoint | ( | const unsigned int | n, |
const vpPoint & | P | ||
) |
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 p.
Referenced by vpMbKltTracker::initFaceFromCorners(), and vpMbEdgeTracker::initFaceFromCorners().
void vpMbtPolygon::changeFrame | ( | const vpHomogeneousMatrix & | cMo | ) |
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(), nbpt, p, and vpPoint::projection().
Referenced by isVisible().
|
inline |
Get the index of the face.
Definition at line 94 of file vpMbtPolygon.h.
|
static |
Definition at line 285 of file vpMbtPolygon.cpp.
Referenced by vpMbtKltPolygon::updateMask().
|
inline |
Return the number of corners.
Definition at line 101 of file vpMbtPolygon.h.
Referenced by vpMbEdgeTracker::addPolygon().
vpPoint & vpMbtPolygon::getPoint | ( | const unsigned int | _index | ) |
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, nbpt, and p.
std::vector< vpImagePoint > vpMbtPolygon::getRoi | ( | const vpCameraParameters & | _cam | ) |
Definition at line 269 of file vpMbtPolygon.cpp.
References vpMeterPixelConversion::convertPoint(), nbpt, and p.
Referenced by vpMbtKltPolygon::init(), and vpMbtKltPolygon::updateMask().
|
inline |
Definition at line 107 of file vpMbtPolygon.h.
bool vpMbtPolygon::isVisible | ( | const vpHomogeneousMatrix & | cMo, |
const bool & | depthTest = false |
||
) |
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 changeFrame(), vpColVector::crossProd(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), isappearing, isvisible, nbpt, and p.
|
virtual |
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 changeFrame(), vpColVector::crossProd(), vpColVector::dotProd(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), isappearing, isvisible, nbpt, vpColVector::normalize(), p, vpPoint::set_X(), vpPoint::set_Y(), and vpPoint::set_Z().
|
inline |
Definition at line 110 of file vpMbtPolygon.h.
|
static |
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 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().
|
virtual |
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.
Referenced by vpMbKltTracker::initFaceFromCorners(), and vpMbEdgeTracker::initFaceFromCorners().
int vpMbtPolygon::index |
Index of the polygon. Cannot be unsigned int because deafult value is -1.
Definition at line 71 of file vpMbtPolygon.h.
Referenced by vpMbtKltPolygon::computeInteractionMatrixAndResidu().
bool vpMbtPolygon::isappearing |
flag to specify whether the face is appearing or not
Definition at line 77 of file vpMbtPolygon.h.
Referenced by isVisible(), and vpMbtPolygon().
bool vpMbtPolygon::isvisible |
flag to specify whether the face is visible or not
Definition at line 75 of file vpMbtPolygon.h.
Referenced by isVisible(), vpMbtKltPolygon::vpMbtKltPolygon(), and vpMbtPolygon().
unsigned int vpMbtPolygon::nbpt |
Number of points used to define the polygon.
Definition at line 73 of file vpMbtPolygon.h.
Referenced by changeFrame(), getPoint(), getRoi(), isVisible(), setNbPoint(), and vpMbtPolygon().
vpPoint* vpMbtPolygon::p |
corners in the object frame
Definition at line 79 of file vpMbtPolygon.h.
Referenced by addPoint(), vpMbEdgeTracker::addPolygon(), changeFrame(), getPoint(), getRoi(), vpMbtKltPolygon::init(), isVisible(), setNbPoint(), vpMbtPolygon(), and ~vpMbtPolygon().