ViSP
2.8.0
|
#include <vpMbtPolygon.h>
Public Types | |
enum | vpMbtPolygonClippingType { NO_CLIPPING = 0, NEAR_CLIPPING = 1, FAR_CLIPPING = 2, LEFT_CLIPPING = 4, RIGHT_CLIPPING = 8, UP_CLIPPING = 16, DOWN_CLIPPING = 32, FOV_CLIPPING = 60, ALL_CLIPPING = 63 } |
Public Member Functions | |
vpMbtPolygon () | |
virtual | ~vpMbtPolygon () |
void | addPoint (const unsigned int n, const vpPoint &P) |
void | changeFrame (const vpHomogeneousMatrix &cMo) |
void | computeRoiClipped (const vpCameraParameters &cam=vpCameraParameters()) |
unsigned int | getClipping () const |
double | getFarClippingDistance () const |
int | getIndex () const |
unsigned int | getNbPoint () const |
unsigned int | getNbCornerInsidePrevImage () const |
unsigned int | getNbCornerInsideImage (const vpImage< unsigned char > &I, const vpCameraParameters &cam) |
double | getNearClippingDistance () const |
vpPoint & | getPoint (const unsigned int _index) |
std::vector< vpImagePoint > | getRoi (const vpCameraParameters &cam) |
std::vector< vpImagePoint > | getRoi (const vpCameraParameters &cam, const vpHomogeneousMatrix &cMo) |
void | getRoiClipped (const vpCameraParameters &cam, std::vector< vpImagePoint > &roi) |
void | getRoiClipped (const vpCameraParameters &cam, std::vector< vpImagePoint > &roi, const vpHomogeneousMatrix &cMo) |
void | getRoiClipped (const vpCameraParameters &cam, std::vector< std::pair< vpImagePoint, unsigned int > > &roi) |
void | getRoiClipped (const vpCameraParameters &cam, std::vector< std::pair< vpImagePoint, unsigned int > > &roi, const vpHomogeneousMatrix &cMo) |
bool | isAppearing () const |
virtual bool | isVisible (const vpHomogeneousMatrix &cMo, const double alpha, const bool &modulo=false) |
bool | isVisible () const |
void | setClipping (const unsigned int &flags) |
void | setFarClippingDistance (const double &dist) |
virtual void | setIndex (const int i) |
virtual void | setNbPoint (const unsigned int nb) |
void | setNearClippingDistance (const double &dist) |
Deprecated functions | |
bool | isVisible (const vpHomogeneousMatrix &cMo, const bool &depthTest=false) |
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 |
unsigned int | nbCornersInsidePrev |
bool | isvisible |
bool | isappearing |
vpPoint * | p |
std::vector< std::pair< vpPoint, unsigned int > > | roiPointsClip |
unsigned int | clippingFlag |
double | distNearClip |
double | distFarClip |
Implementation of a polygon of the model used by the model-based tracker.
Definition at line 67 of file vpMbtPolygon.h.
Enumerator | |
---|---|
NO_CLIPPING | |
NEAR_CLIPPING | |
FAR_CLIPPING | |
LEFT_CLIPPING | |
RIGHT_CLIPPING | |
UP_CLIPPING | |
DOWN_CLIPPING | |
FOV_CLIPPING | |
ALL_CLIPPING |
Definition at line 70 of file vpMbtPolygon.h.
vpMbtPolygon::vpMbtPolygon | ( | ) |
Basic constructor.
Definition at line 58 of file vpMbtPolygon.cpp.
References clippingFlag, distFarClip, distNearClip, isappearing, isvisible, nbCornersInsidePrev, nbpt, NO_CLIPPING, 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 121 of file vpMbtPolygon.cpp.
References p.
Referenced by vpMbtDistanceLine::buildFrom(), 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 133 of file vpMbtPolygon.cpp.
References vpPoint::changeFrame(), nbpt, p, and vpPoint::projection().
Referenced by getRoi(), getRoiClipped(), and isVisible().
void vpMbtPolygon::computeRoiClipped | ( | const vpCameraParameters & | cam = vpCameraParameters() | ) |
Compute the region of interest in the image according to the used clipping.
cam | : camera parameters used to compute the field of view. |
Definition at line 232 of file vpMbtPolygon.cpp.
References clippingFlag, vpCameraParameters::getFovNormals(), vpCameraParameters::isFovComputed(), nbpt, NO_CLIPPING, p, vpPoint::projection(), and roiPointsClip.
Referenced by vpMbtDistanceLine::display(), getRoiClipped(), vpMbtDistanceLine::initMovingEdge(), vpMbtKltPolygon::updateMask(), and vpMbtDistanceLine::updateMovingEdge().
|
inline |
Get the clipping used.
Definition at line 134 of file vpMbtPolygon.h.
Referenced by vpMbtDistanceLine::display(), vpMbtDistanceLine::initMovingEdge(), and vpMbtDistanceLine::updateMovingEdge().
|
inline |
Get the far distance for clipping.
Definition at line 141 of file vpMbtPolygon.h.
|
inline |
Get the index of the face.
Definition at line 148 of file vpMbtPolygon.h.
|
static |
Definition at line 574 of file vpMbtPolygon.cpp.
Referenced by vpMbtKltPolygon::updateMask().
unsigned int vpMbtPolygon::getNbCornerInsideImage | ( | const vpImage< unsigned char > & | I, |
const vpCameraParameters & | cam | ||
) |
Static method to check the number of points of a region defined by the vector of image point that are inside the image.
I | : The image used for its size. |
cam | : The camera parameters. |
Definition at line 552 of file vpMbtPolygon.cpp.
References vpMeterPixelConversion::convertPoint(), vpImagePoint::get_i(), vpImagePoint::get_j(), vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), nbCornersInsidePrev, nbpt, and p.
|
inline |
Return the number of corners at the previous computation.
Definition at line 162 of file vpMbtPolygon.h.
|
inline |
Return the number of corners.
Definition at line 155 of file vpMbtPolygon.h.
Referenced by vpMbEdgeTracker::addPolygon().
|
inline |
Get the near distance for clipping.
Definition at line 171 of file vpMbtPolygon.h.
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 92 of file vpMbtPolygon.cpp.
References vpException::dimensionError, nbpt, and p.
std::vector< vpImagePoint > vpMbtPolygon::getRoi | ( | const vpCameraParameters & | cam | ) |
Get the region of interest in the image.
cam | : camera parameters. |
Definition at line 450 of file vpMbtPolygon.cpp.
References vpMeterPixelConversion::convertPoint(), nbpt, and p.
Referenced by getRoi().
std::vector< vpImagePoint > vpMbtPolygon::getRoi | ( | const vpCameraParameters & | cam, |
const vpHomogeneousMatrix & | cMo | ||
) |
Get the region of interest in the image.
cam | : camera parameters. |
cMo | : pose. |
Definition at line 471 of file vpMbtPolygon.cpp.
References changeFrame(), and getRoi().
void vpMbtPolygon::getRoiClipped | ( | const vpCameraParameters & | cam, |
std::vector< vpImagePoint > & | roi | ||
) |
Get the region of interest clipped in the image.
cam | : camera parameters. |
roi | : image point corresponding to the region of interest. |
Definition at line 486 of file vpMbtPolygon.cpp.
References vpMeterPixelConversion::convertPoint(), and roiPointsClip.
Referenced by getRoiClipped(), vpMbtKltPolygon::init(), and vpMbtKltPolygon::updateMask().
void vpMbtPolygon::getRoiClipped | ( | const vpCameraParameters & | cam, |
std::vector< vpImagePoint > & | roi, | ||
const vpHomogeneousMatrix & | cMo | ||
) |
Get the region of interest clipped in the image.
cam | : camera parameters. |
cMo | : pose. |
roi | : image point corresponding to the region of interest. |
Definition at line 503 of file vpMbtPolygon.cpp.
References changeFrame(), computeRoiClipped(), and getRoiClipped().
void vpMbtPolygon::getRoiClipped | ( | const vpCameraParameters & | cam, |
std::vector< std::pair< vpImagePoint, unsigned int > > & | roi | ||
) |
Get the region of interest clipped in the image and the information to know if it's a clipped point.
cam | : camera parameters. |
roi | : image point corresponding to the region of interest with clipping information. |
Definition at line 519 of file vpMbtPolygon.cpp.
References vpMeterPixelConversion::convertPoint(), and roiPointsClip.
void vpMbtPolygon::getRoiClipped | ( | const vpCameraParameters & | cam, |
std::vector< std::pair< vpImagePoint, unsigned int > > & | roi, | ||
const vpHomogeneousMatrix & | cMo | ||
) |
Get the region of interest clipped in the image and the information to know if it's a clipped point.
cam | : camera parameters. |
roi | : image point corresponding to the region of interest with clipping information. |
cMo | : pose. |
Definition at line 536 of file vpMbtPolygon.cpp.
References changeFrame(), computeRoiClipped(), and getRoiClipped().
|
inline |
Definition at line 187 of file vpMbtPolygon.h.
|
virtual |
Check if the polygon is visible in the image and if the angle between the normal to the face and the line vector going from the optical center to the cog of the face 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). |
modulo | : Indicates if the test should also consider faces that are not oriented counter clockwise. If true, the orientation of the face is without importance. |
Definition at line 156 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, vpMath::rad(), vpPoint::set_X(), vpPoint::set_Y(), and vpPoint::set_Z().
|
inline |
Definition at line 189 of file vpMbtPolygon.h.
Referenced by isVisible().
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 643 of file vpMbtPolygon.cpp.
References changeFrame(), isappearing, isvisible, isVisible(), nbpt, p, and vpMath::rad().
|
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 615 of file vpMbtPolygon.cpp.
References vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().
|
inline |
Specify which clipping to use.
flags | : New clipping flags. |
Definition at line 198 of file vpMbtPolygon.h.
Referenced by vpMbEdgeTracker::addLine(), and vpMbEdgeTracker::setClipping().
|
inline |
Set the far distance for clipping.
dist | : Far clipping value. |
Definition at line 205 of file vpMbtPolygon.h.
References FAR_CLIPPING.
Referenced by vpMbEdgeTracker::addLine(), and vpMbEdgeTracker::setFarClippingDistance().
|
inlinevirtual |
Set the index of the face.
i | : the new index of the face. |
Definition at line 212 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 106 of file vpMbtPolygon.cpp.
Referenced by vpMbtDistanceLine::buildFrom(), vpMbKltTracker::initFaceFromCorners(), and vpMbEdgeTracker::initFaceFromCorners().
|
inline |
Set the near distance for clipping.
dist | : Near clipping value. |
Definition at line 220 of file vpMbtPolygon.h.
References NEAR_CLIPPING.
Referenced by vpMbEdgeTracker::addLine(), and vpMbEdgeTracker::setNearClippingDistance().
unsigned int vpMbtPolygon::clippingFlag |
Clipping flag.
Definition at line 99 of file vpMbtPolygon.h.
Referenced by computeRoiClipped(), and vpMbtPolygon().
double vpMbtPolygon::distFarClip |
Distance for near clipping.
Definition at line 103 of file vpMbtPolygon.h.
Referenced by vpMbtPolygon().
double vpMbtPolygon::distNearClip |
Distance for near clipping.
Definition at line 101 of file vpMbtPolygon.h.
Referenced by vpMbtPolygon().
int vpMbtPolygon::index |
Index of the polygon. Cannot be unsigned int because deafult value is -1.
Definition at line 85 of file vpMbtPolygon.h.
Referenced by vpMbtKltPolygon::computeInteractionMatrixAndResidu().
bool vpMbtPolygon::isappearing |
flag to specify whether the face is appearing or not
Definition at line 93 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 91 of file vpMbtPolygon.h.
Referenced by isVisible(), vpMbtKltPolygon::vpMbtKltPolygon(), and vpMbtPolygon().
unsigned int vpMbtPolygon::nbCornersInsidePrev |
Number of corners inside the image during the last call to getNbCornerInsideImage.
Definition at line 89 of file vpMbtPolygon.h.
Referenced by getNbCornerInsideImage(), and vpMbtPolygon().
unsigned int vpMbtPolygon::nbpt |
Number of points used to define the polygon.
Definition at line 87 of file vpMbtPolygon.h.
Referenced by changeFrame(), computeRoiClipped(), getNbCornerInsideImage(), getPoint(), getRoi(), isVisible(), setNbPoint(), and vpMbtPolygon().
vpPoint* vpMbtPolygon::p |
corners in the object frame
Definition at line 95 of file vpMbtPolygon.h.
Referenced by addPoint(), vpMbEdgeTracker::addPolygon(), vpMbtDistanceLine::buildFrom(), changeFrame(), computeRoiClipped(), getNbCornerInsideImage(), getPoint(), getRoi(), vpMbtKltPolygon::init(), isVisible(), setNbPoint(), vpMbtPolygon(), and ~vpMbtPolygon().
std::vector<std::pair<vpPoint,unsigned int> > vpMbtPolygon::roiPointsClip |
Region of interest clipped.
Definition at line 97 of file vpMbtPolygon.h.
Referenced by computeRoiClipped(), vpMbtDistanceLine::display(), getRoiClipped(), vpMbtDistanceLine::initMovingEdge(), and vpMbtDistanceLine::updateMovingEdge().