Visual Servoing Platform
version 3.6.1 under development (2024-12-10)
|
#include <visp3/mbt/vpMbtPolygon.h>
Public Types | |
enum | vpPolygon3DClippingType { 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 () | |
vpMbtPolygon (const vpMbtPolygon &mbtp) | |
int | getIndex () const |
std::string | getName () const |
bool | isAppearing () const |
bool | isPolygonOriented () |
virtual bool | isVisible (const vpHomogeneousMatrix &cMo, double alpha, const bool &modulo=false, const vpCameraParameters &cam=vpCameraParameters(), unsigned int width=0, unsigned int height=0) |
bool | isVisible () const |
vpMbtPolygon & | operator= (const vpMbtPolygon &mbtp) |
virtual void | setIndex (int i) |
void | setLod (bool use_lod) |
void | setMinLineLengthThresh (double min_line_length) |
void | setMinPolygonAreaThresh (double min_polygon_area) |
void | setName (const std::string &face_name) |
void | setIsPolygonOriented (const bool &oriented) |
void | addPoint (unsigned int n, const vpPoint &P) |
void | changeFrame (const vpHomogeneousMatrix &cMo) |
void | computePolygonClipped (const vpCameraParameters &cam=vpCameraParameters()) |
unsigned int | getClipping () const |
double | getFarClippingDistance () 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) |
void | getPolygonClipped (std::vector< std::pair< vpPoint, unsigned int > > &poly) |
void | getPolygonClipped (std::vector< vpPoint > &poly) |
void | setClipping (const unsigned int &flags) |
void | setFarClippingDistance (const double &dist) |
virtual void | setNbPoint (unsigned int nb) |
void | setNearClippingDistance (const double &dist) |
Static Public Member Functions | |
static void | getClippedPolygon (const std::vector< vpPoint > &ptIn, std::vector< vpPoint > &ptOut, const vpHomogeneousMatrix &cMo, const unsigned int &clippingFlags, const vpCameraParameters &cam=vpCameraParameters(), const double &znear=0.001, const double &zfar=100) |
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 |
bool | isvisible |
bool | isappearing |
bool | useLod |
double | minLineLengthThresh |
double | minPolygonAreaThresh |
std::string | name |
bool | hasOrientation |
unsigned int | nbpt |
unsigned int | nbCornersInsidePrev |
vpPoint * | p |
std::vector< std::pair< vpPoint, unsigned int > > | polyClipped |
unsigned int | clippingFlag |
double | distNearClip |
double | distFarClip |
Implementation of a polygon of the model used by the model-based tracker.
Definition at line 59 of file vpMbtPolygon.h.
|
inherited |
Enumerator | |
---|---|
NO_CLIPPING | |
NEAR_CLIPPING | |
FAR_CLIPPING | |
LEFT_CLIPPING | |
RIGHT_CLIPPING | |
UP_CLIPPING | |
DOWN_CLIPPING | |
FOV_CLIPPING | |
ALL_CLIPPING |
Definition at line 59 of file vpPolygon3D.h.
BEGIN_VISP_NAMESPACE vpMbtPolygon::vpMbtPolygon | ( | ) |
Basic constructor.
Definition at line 55 of file vpMbtPolygon.cpp.
vpMbtPolygon::vpMbtPolygon | ( | const vpMbtPolygon & | mbtp | ) |
Definition at line 60 of file vpMbtPolygon.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 134 of file vpPolygon3D.cpp.
References vpPolygon3D::p.
Referenced by vpMbTracker::addPolygon(), vpMbTracker::addProjectionErrorPolygon(), vpMbtDistanceLine::buildFrom(), and vpPolygon3D::getClippedPolygon().
|
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 146 of file vpPolygon3D.cpp.
References vpPoint::changeFrame(), vpPolygon3D::nbpt, vpPolygon3D::p, and vpPoint::projection().
Referenced by vpPolygon3D::getClippedPolygon(), vpPolygon3D::getRoi(), vpPolygon3D::getRoiClipped(), and isVisible().
|
inherited |
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 161 of file vpPolygon3D.cpp.
References vpPolygon3D::clippingFlag, vpPolygon3D::distFarClip, vpPolygon3D::distNearClip, vpPolygon3D::DOWN_CLIPPING, vpPolygon3D::FAR_CLIPPING, vpCameraParameters::getFovNormals(), vpCameraParameters::isFovComputed(), vpPolygon3D::LEFT_CLIPPING, vpPolygon3D::nbpt, vpPolygon3D::NO_CLIPPING, vpPolygon3D::p, vpPolygon3D::polyClipped, vpPoint::projection(), vpPolygon3D::RIGHT_CLIPPING, and vpPolygon3D::UP_CLIPPING.
Referenced by vpPolygon3D::getClippedPolygon(), vpMbtDistanceLine::getModelForDisplay(), vpPolygon3D::getRoiClipped(), vpMbtDistanceLine::initMovingEdge(), isVisible(), and vpMbtDistanceLine::updateMovingEdge().
|
staticinherited |
Static method to compute the clipped points from a set of initial points.
ptIn | : Input points |
ptOut | : Output points (result of the clipping). |
cMo | : Pose considered for the clipping. |
clippingFlags | Clipping flag (see vpPolygon3D::vpPolygon3DClippingType). |
cam | : Camera parameters (Only used if clipping flags contain FOV clipping). |
znear | : Near clipping distance value (Only used if clipping flags contain Near clipping). |
zfar | : Far clipping distance value (Only used if clipping flags contain Far clipping). |
Definition at line 572 of file vpPolygon3D.cpp.
References vpPolygon3D::addPoint(), vpPolygon3D::changeFrame(), vpPolygon3D::computePolygonClipped(), vpPolygon3D::FAR_CLIPPING, vpPolygon3D::getPolygonClipped(), vpPolygon3D::NEAR_CLIPPING, vpPolygon3D::setClipping(), vpPolygon3D::setFarClippingDistance(), vpPolygon3D::setNbPoint(), and vpPolygon3D::setNearClippingDistance().
Referenced by vpImageSimulator::setCameraPosition().
|
inlineinherited |
Get the clipping used.
Definition at line 116 of file vpPolygon3D.h.
Referenced by vpMbtDistanceLine::getModelForDisplay(), vpMbtDistanceLine::initMovingEdge(), and vpMbtDistanceLine::updateMovingEdge().
|
inlineinherited |
Get the far distance for clipping.
Definition at line 123 of file vpPolygon3D.h.
|
inline |
Get the index of the face.
Definition at line 93 of file vpMbtPolygon.h.
Referenced by vpMbDepthDenseTracker::addFace(), vpMbDepthNormalTracker::addFace(), vpMbEdgeTracker::addPolygon(), vpMbtFaceDepthDense::computeDesiredFeatures(), vpMbtFaceDepthNormal::computeDesiredFeatures(), vpMbEdgeTracker::initFaceFromCorners(), vpMbEdgeTracker::initFaceFromLines(), vpMbTracker::initProjectionErrorFaceFromCorners(), and vpMbTracker::initProjectionErrorFaceFromLines().
|
staticinherited |
Definition at line 595 of file vpPolygon3D.cpp.
|
inline |
Get the name of the face.
Definition at line 100 of file vpMbtPolygon.h.
Referenced by vpMbDepthDenseTracker::addFace(), vpMbDepthNormalTracker::addFace(), vpMbEdgeTracker::initFaceFromCorners(), vpMbEdgeTracker::initFaceFromLines(), vpMbTracker::initProjectionErrorFaceFromCorners(), vpMbTracker::initProjectionErrorFaceFromLines(), vpMbDepthDenseTracker::setUseDepthDenseTracking(), and vpMbDepthNormalTracker::setUseDepthNormalTracking().
|
inherited |
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 535 of file vpPolygon3D.cpp.
References vpMeterPixelConversion::convertPoint(), vpImagePoint::get_i(), vpImagePoint::get_j(), vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpPolygon3D::nbCornersInsidePrev, vpPolygon3D::nbpt, and vpPolygon3D::p.
|
inlineinherited |
Return the number of corners at the previous computation.
Definition at line 137 of file vpPolygon3D.h.
|
inlineinherited |
Return the number of corners.
Definition at line 130 of file vpPolygon3D.h.
Referenced by vpMbDepthDenseTracker::addFace(), vpMbDepthNormalTracker::addFace(), vpMbEdgeTracker::addPolygon(), vpMbEdgeTracker::initFaceFromCorners(), vpMbEdgeTracker::initFaceFromLines(), vpMbTracker::initProjectionErrorFaceFromCorners(), and vpMbTracker::initProjectionErrorFaceFromLines().
|
inlineinherited |
Get the near distance for clipping.
Definition at line 146 of file vpPolygon3D.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 107 of file vpPolygon3D.cpp.
References vpException::dimensionError, vpPolygon3D::nbpt, and vpPolygon3D::p.
|
inherited |
Get the 3D clipped points and their clipping information.
poly | : resulting points plus clipping information. |
Definition at line 439 of file vpPolygon3D.cpp.
References vpPolygon3D::polyClipped.
Referenced by vpMbtFaceDepthNormal::computeNormalVisibility(), vpMbtFaceDepthDense::computeROI(), vpPolygon3D::getClippedPolygon(), and vpMbtFaceDepthNormal::planeIsInvalid().
|
inherited |
Get the 3D clipped points.
poly | : resulting points. |
Definition at line 449 of file vpPolygon3D.cpp.
References vpPolygon3D::polyClipped.
|
inherited |
Get the region of interest in the image.
cam | : camera parameters. |
Definition at line 388 of file vpPolygon3D.cpp.
References vpMeterPixelConversion::convertPoint(), vpPolygon3D::nbpt, and vpPolygon3D::p.
Referenced by vpPolygon3D::getRoi().
|
inherited |
Get the region of interest in the image.
cam | : camera parameters. |
cMo | : pose. |
Definition at line 408 of file vpPolygon3D.cpp.
References vpPolygon3D::changeFrame(), and vpPolygon3D::getRoi().
|
inherited |
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 502 of file vpPolygon3D.cpp.
References vpMeterPixelConversion::convertPoint(), and vpPolygon3D::polyClipped.
|
inherited |
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 520 of file vpPolygon3D.cpp.
References vpPolygon3D::changeFrame(), vpPolygon3D::computePolygonClipped(), and vpPolygon3D::getRoiClipped().
|
inherited |
Get the region of interest clipped in the image.
cam | : camera parameters. |
roi | : image point corresponding to the region of interest. |
Definition at line 465 of file vpPolygon3D.cpp.
References vpMeterPixelConversion::convertPoint(), and vpPolygon3D::polyClipped.
Referenced by vpMbtFaceDepthNormal::computeNormalVisibility(), vpMbtFaceDepthNormal::computeROI(), vpMbtFaceDepthDense::computeROI(), vpPolygon3D::getRoiClipped(), and isVisible().
|
inherited |
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 483 of file vpPolygon3D.cpp.
References vpPolygon3D::changeFrame(), vpPolygon3D::computePolygonClipped(), and vpPolygon3D::getRoiClipped().
|
inline |
Definition at line 102 of file vpMbtPolygon.h.
|
inline |
Definition at line 103 of file vpMbtPolygon.h.
|
inline |
Definition at line 107 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. |
cam | : Camera parameters (intrinsics parameters) |
width,height | : Image size used to consider level of detail. |
Definition at line 99 of file vpMbtPolygon.cpp.
References vpPolygon3D::changeFrame(), vpPolygon3D::clippingFlag, vpCameraParameters::computeFov(), vpPolygon3D::computePolygonClipped(), vpTracker::cP, vpColVector::dotProd(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), vpPolygon::getArea(), vpPolygon3D::getRoiClipped(), hasOrientation, isappearing, isvisible, minLineLengthThresh, minPolygonAreaThresh, vpPolygon3D::nbpt, vpColVector::normalize(), vpPolygon3D::p, vpMath::rad(), vpPoint::set_X(), vpPoint::set_Y(), vpPoint::set_Z(), and useLod.
Referenced by vpMbtFaceDepthDense::computeVisibility(), vpMbtFaceDepthNormal::computeVisibility(), vpMbtFaceDepthDense::getModelForDisplay(), and vpMbtFaceDepthNormal::getModelForDisplay().
vpMbtPolygon & vpMbtPolygon::operator= | ( | const vpMbtPolygon & | mbtp | ) |
Definition at line 68 of file vpMbtPolygon.cpp.
References hasOrientation, index, isappearing, isvisible, minLineLengthThresh, minPolygonAreaThresh, name, vpPolygon3D::operator=(), and useLod.
|
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 636 of file vpPolygon3D.cpp.
References vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().
|
inlineinherited |
Specify which clipping to use.
flags | : New clipping flags. |
Definition at line 185 of file vpPolygon3D.h.
Referenced by vpMbEdgeTracker::addLine(), vpMbtFaceDepthDense::addLine(), vpMbtFaceDepthNormal::addLine(), vpMbTracker::addProjectionErrorLine(), vpPolygon3D::getClippedPolygon(), and vpMbEdgeTracker::setClipping().
|
inlineinherited |
Set the far distance for clipping.
dist | : Far clipping value. |
Definition at line 192 of file vpPolygon3D.h.
References vpPolygon3D::FAR_CLIPPING.
Referenced by vpMbEdgeTracker::addLine(), vpMbtFaceDepthDense::addLine(), vpMbtFaceDepthNormal::addLine(), vpMbTracker::addProjectionErrorLine(), vpPolygon3D::getClippedPolygon(), and vpMbEdgeTracker::setFarClippingDistance().
|
inlinevirtual |
Set the index of the face.
i | : the new index of the face. |
Definition at line 116 of file vpMbtPolygon.h.
Referenced by vpMbTracker::addPolygon(), and vpMbTracker::addProjectionErrorPolygon().
|
inline |
Set if the polygon is oriented or not.
oriented | : True if the polygon is oriented, false otherwise. |
Definition at line 158 of file vpMbtPolygon.h.
Referenced by vpMbTracker::addPolygon(), and vpMbTracker::addProjectionErrorPolygon().
void vpMbtPolygon::setLod | ( | bool | use_lod | ) |
Set the flag to consider if the level of detail (LOD) is used or not. When activated, lines and faces of the 3D model are tracked if respectively their projected length and area in the image are significative enough. By significative, we mean:
use_lod | : true if level of detail must be used, false otherwise. |
The sample code below shows how to introduce this feature:
Definition at line 275 of file vpMbtPolygon.cpp.
References useLod.
Referenced by vpMbTracker::addPolygon(), and vpMbTracker::addProjectionErrorPolygon().
|
inline |
Set the threshold for the minimum line length to be considered as visible in the LOD (level of detail) case. This threshold is only used when setLoD() is turned on.
min_line_length | : threshold for the minimum line length in pixel. When a single line that doesn't belong to a face is considered by the tracker, this line is tracked only if its length in pixel is greater than min_line_length. |
Definition at line 133 of file vpMbtPolygon.h.
Referenced by vpMbTracker::addPolygon(), and vpMbTracker::addProjectionErrorPolygon().
|
inline |
Set the minimum polygon area to be considered as visible in the LOD (level of detail) case. This threshold is only used when setLoD() is turned on.
min_polygon_area | : threshold for the minimum polygon area in pixel. When a face is considered by the tracker, this face is tracked only if its area in pixel is greater than min_polygon_area. |
Definition at line 144 of file vpMbtPolygon.h.
Referenced by vpMbTracker::addPolygon(), and vpMbTracker::addProjectionErrorPolygon().
|
inline |
Set the name of the face.
face_name | : name of the face. |
Definition at line 151 of file vpMbtPolygon.h.
Referenced by vpMbTracker::addPolygon(), and vpMbTracker::addProjectionErrorPolygon().
|
virtualinherited |
Set the number of points which are the corners of the polygon.
nb | : The number of corners. |
Definition at line 120 of file vpPolygon3D.cpp.
References vpPolygon3D::nbpt, and vpPolygon3D::p.
Referenced by vpMbTracker::addPolygon(), vpMbTracker::addProjectionErrorPolygon(), vpMbtDistanceLine::buildFrom(), and vpPolygon3D::getClippedPolygon().
|
inlineinherited |
Set the near distance for clipping.
dist | : Near clipping value. |
Definition at line 205 of file vpPolygon3D.h.
References vpPolygon3D::NEAR_CLIPPING.
Referenced by vpMbEdgeTracker::addLine(), vpMbtFaceDepthDense::addLine(), vpMbtFaceDepthNormal::addLine(), vpMbTracker::addProjectionErrorLine(), vpPolygon3D::getClippedPolygon(), and vpMbEdgeTracker::setNearClippingDistance().
|
inherited |
Clipping flag.
Definition at line 83 of file vpPolygon3D.h.
Referenced by vpPolygon3D::computePolygonClipped(), isVisible(), and vpPolygon3D::operator=().
|
inherited |
Distance for near clipping.
Definition at line 87 of file vpPolygon3D.h.
Referenced by vpPolygon3D::computePolygonClipped(), and vpPolygon3D::operator=().
|
inherited |
Distance for near clipping.
Definition at line 85 of file vpPolygon3D.h.
Referenced by vpPolygon3D::computePolygonClipped(), and vpPolygon3D::operator=().
bool vpMbtPolygon::hasOrientation |
Boolean that specify if the polygon has an orientation or not (mainly used for cylinders)
Definition at line 82 of file vpMbtPolygon.h.
Referenced by isVisible(), and operator=().
int vpMbtPolygon::index |
Index of the polygon. Cannot be unsigned int because default value is -1.
Definition at line 64 of file vpMbtPolygon.h.
Referenced by operator=().
bool vpMbtPolygon::isappearing |
flag to specify whether the face is appearing or not
Definition at line 68 of file vpMbtPolygon.h.
Referenced by isVisible(), and operator=().
bool vpMbtPolygon::isvisible |
flag to specify whether the face is visible or not
Definition at line 66 of file vpMbtPolygon.h.
Referenced by vpMbtFaceDepthDense::isVisible(), vpMbtFaceDepthNormal::isVisible(), isVisible(), and operator=().
double vpMbtPolygon::minLineLengthThresh |
Threshold for minimum line length in pixel to consider if the line is visible or not in LOD case
Definition at line 74 of file vpMbtPolygon.h.
Referenced by isVisible(), and operator=().
double vpMbtPolygon::minPolygonAreaThresh |
Threshold for minimum polygon area in pixel to consider if the polygon is visible or not in LOD case
Definition at line 77 of file vpMbtPolygon.h.
Referenced by isVisible(), and operator=().
std::string vpMbtPolygon::name |
|
inherited |
Number of corners inside the image during the last call to getNbCornerInsideImage
Definition at line 77 of file vpPolygon3D.h.
Referenced by vpPolygon3D::getNbCornerInsideImage(), and vpPolygon3D::operator=().
|
inherited |
Number of points used to define the polygon.
Definition at line 74 of file vpPolygon3D.h.
Referenced by vpMbDepthDenseTracker::addFace(), vpMbDepthNormalTracker::addFace(), vpPolygon3D::changeFrame(), vpPolygon3D::computePolygonClipped(), vpPolygon3D::getNbCornerInsideImage(), vpPolygon3D::getPoint(), vpPolygon3D::getRoi(), isVisible(), vpPolygon3D::operator=(), vpPolygon3D::setNbPoint(), and vpPolygon3D::vpPolygon3D().
|
inherited |
corners in the object frame
Definition at line 79 of file vpPolygon3D.h.
Referenced by vpMbDepthDenseTracker::addFace(), vpMbDepthNormalTracker::addFace(), vpPolygon3D::addPoint(), vpMbEdgeTracker::addPolygon(), vpMbtDistanceLine::buildFrom(), vpPolygon3D::changeFrame(), vpPolygon3D::computePolygonClipped(), vpPolygon3D::getNbCornerInsideImage(), vpPolygon3D::getPoint(), vpPolygon3D::getRoi(), vpMbEdgeTracker::initFaceFromCorners(), vpMbEdgeTracker::initFaceFromLines(), vpMbTracker::initProjectionErrorFaceFromCorners(), vpMbTracker::initProjectionErrorFaceFromLines(), isVisible(), vpPolygon3D::operator=(), vpPolygon3D::setNbPoint(), vpPolygon3D::vpPolygon3D(), and vpPolygon3D::~vpPolygon3D().
|
inherited |
Region of interest clipped.
Definition at line 81 of file vpPolygon3D.h.
Referenced by vpPolygon3D::computePolygonClipped(), vpMbtDistanceLine::getModelForDisplay(), vpPolygon3D::getPolygonClipped(), vpPolygon3D::getRoiClipped(), vpMbtDistanceLine::initMovingEdge(), vpPolygon3D::operator=(), and vpMbtDistanceLine::updateMovingEdge().
bool vpMbtPolygon::useLod |
Flag to specify if the visibility of the polygon depends also of the current level of detail (LOD)
Definition at line 71 of file vpMbtPolygon.h.
Referenced by isVisible(), operator=(), and setLod().