![]() |
Visual Servoing Platform version 3.7.0
|
#include <vpPolygon3D.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 | |
| vpPolygon3D () | |
| vpPolygon3D (const vpPolygon3D &mbtp) | |
| virtual | ~vpPolygon3D () |
| 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) |
Public Attributes | |
| unsigned int | nbpt |
| unsigned int | nbCornersInsidePrev |
| vpPoint * | p |
| std::vector< std::pair< vpPoint, unsigned int > > | polyClipped |
| unsigned int | clippingFlag |
| double | distNearClip |
| double | distFarClip |
Deprecated functions | |
| VP_DEPRECATED void | getRoiClipped (std::vector< vpPoint > &points) |
| void | getPolygonClipped (std::vector< std::pair< vpPoint, unsigned int > > &poly) |
| void | getPolygonClipped (std::vector< vpPoint > &poly) |
| vpPolygon3D & | operator= (const vpPolygon3D &mbtp) |
| void | setClipping (const unsigned int &flags) |
| void | setFarClippingDistance (const double &dist) |
| virtual void | setNbPoint (unsigned int nb) |
| void | setNearClippingDistance (const double &dist) |
| 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) |
Implements a 3D polygon with render functionalities like clipping.
Definition at line 56 of file vpPolygon3D.h.
| 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 vpPolygon3D::vpPolygon3D | ( | ) |
Basic constructor.
Definition at line 50 of file vpPolygon3D.cpp.
References clippingFlag, distFarClip, distNearClip, nbCornersInsidePrev, nbpt, NO_CLIPPING, p, polyClipped, and vpPolygon3D().
Referenced by getClippedPolygon(), operator=(), vpMbtPolygon::vpMbtPolygon(), vpPolygon3D(), and vpPolygon3D().
| vpPolygon3D::vpPolygon3D | ( | const vpPolygon3D & | mbtp | ) |
Definition at line 55 of file vpPolygon3D.cpp.
References clippingFlag, distFarClip, distNearClip, nbCornersInsidePrev, nbpt, p, polyClipped, and vpPolygon3D().
|
virtual |
| void vpPolygon3D::addPoint | ( | 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 129 of file vpPolygon3D.cpp.
References p.
Referenced by vpMbtFaceDepthDense::addLine(), vpMbtFaceDepthNormal::addLine(), vpMbTracker::addPolygon(), vpMbTracker::addPolygon(), vpMbTracker::addPolygon(), vpMbTracker::addPolygon(), vpMbTracker::addProjectionErrorPolygon(), vpMbTracker::addProjectionErrorPolygon(), vpMbTracker::addProjectionErrorPolygon(), vpMbTracker::addProjectionErrorPolygon(), and getClippedPolygon().
| void vpPolygon3D::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 141 of file vpPolygon3D.cpp.
Referenced by getClippedPolygon(), getRoi(), getRoiClipped(), getRoiClipped(), vpMbtPolygon::isVisible(), vpMbKltTracker::reinit(), and vpMbKltTracker::setPose().
| void vpPolygon3D::computePolygonClipped | ( | 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 156 of file vpPolygon3D.cpp.
References clippingFlag, distFarClip, distNearClip, DOWN_CLIPPING, FAR_CLIPPING, LEFT_CLIPPING, nbpt, NO_CLIPPING, p, polyClipped, vpPoint::projection(), RIGHT_CLIPPING, and UP_CLIPPING.
Referenced by getClippedPolygon(), getRoiClipped(), getRoiClipped(), vpMbtPolygon::isVisible(), vpMbKltTracker::reinit(), and vpMbKltTracker::setPose().
|
static |
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 561 of file vpPolygon3D.cpp.
References addPoint(), changeFrame(), computePolygonClipped(), FAR_CLIPPING, getPolygonClipped(), NEAR_CLIPPING, setClipping(), setFarClippingDistance(), setNbPoint(), setNearClippingDistance(), and vpPolygon3D().
Referenced by vpImageSimulator::setCameraPosition().
|
inline |
Get the clipping used.
Definition at line 116 of file vpPolygon3D.h.
References clippingFlag.
|
inline |
Get the far distance for clipping.
Definition at line 123 of file vpPolygon3D.h.
References distFarClip.
|
static |
Definition at line 584 of file vpPolygon3D.cpp.
Referenced by vpMbtDistanceKltCylinder::updateMask(), and vpMbtDistanceKltPoints::updateMask().
| unsigned int vpPolygon3D::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 526 of file vpPolygon3D.cpp.
References vpMeterPixelConversion::convertPoint(), vpImagePoint::get_i(), vpImagePoint::get_j(), nbCornersInsidePrev, nbpt, and p.
|
inline |
Return the number of corners at the previous computation.
Definition at line 137 of file vpPolygon3D.h.
References nbCornersInsidePrev.
|
inline |
Return the number of corners.
Definition at line 130 of file vpPolygon3D.h.
References nbpt.
Referenced by vpMbDepthDenseTracker::addFace(), vpMbDepthNormalTracker::addFace(), vpMbKltTracker::computeVVSInteractionMatrixAndResidu(), vpMbEdgeTracker::initFaceFromCorners(), vpMbEdgeTracker::initFaceFromLines(), vpMbTracker::initProjectionErrorFaceFromCorners(), vpMbTracker::initProjectionErrorFaceFromLines(), vpMbKltTracker::postTracking(), vpMbKltTracker::preTracking(), vpMbKltTracker::reinit(), vpMbKltTracker::setPose(), and vpMbKltTracker::testTracking().
|
inline |
Get the near distance for clipping.
Definition at line 146 of file vpPolygon3D.h.
References distNearClip.
| vpPoint & vpPolygon3D::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 102 of file vpPolygon3D.cpp.
References vpException::dimensionError, nbpt, and p.
| void vpPolygon3D::getPolygonClipped | ( | std::vector< std::pair< vpPoint, unsigned int > > & | poly | ) |
Get the 3D clipped points and their clipping information.
| poly | : resulting points plus clipping information. |
Definition at line 430 of file vpPolygon3D.cpp.
References polyClipped.
Referenced by getClippedPolygon().
| void vpPolygon3D::getPolygonClipped | ( | std::vector< vpPoint > & | poly | ) |
Get the 3D clipped points.
| poly | : resulting points. |
Definition at line 440 of file vpPolygon3D.cpp.
References polyClipped.
| std::vector< vpImagePoint > vpPolygon3D::getRoi | ( | const vpCameraParameters & | cam | ) |
Get the region of interest in the image.
| cam | : camera parameters. |
Definition at line 379 of file vpPolygon3D.cpp.
References vpMeterPixelConversion::convertPoint(), nbpt, and p.
Referenced by getRoi().
| std::vector< vpImagePoint > vpPolygon3D::getRoi | ( | const vpCameraParameters & | cam, |
| const vpHomogeneousMatrix & | cMo ) |
Get the region of interest in the image.
| cam | : camera parameters. |
| cMo | : pose. |
Definition at line 399 of file vpPolygon3D.cpp.
References changeFrame(), and getRoi().
| void vpPolygon3D::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 493 of file vpPolygon3D.cpp.
References vpMeterPixelConversion::convertPoint(), and polyClipped.
| void vpPolygon3D::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 511 of file vpPolygon3D.cpp.
References changeFrame(), computePolygonClipped(), and getRoiClipped().
| void vpPolygon3D::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 456 of file vpPolygon3D.cpp.
References vpMeterPixelConversion::convertPoint(), and polyClipped.
Referenced by getRoiClipped(), getRoiClipped(), and vpMbtPolygon::isVisible().
| void vpPolygon3D::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 474 of file vpPolygon3D.cpp.
References changeFrame(), computePolygonClipped(), and getRoiClipped().
| void vpPolygon3D::getRoiClipped | ( | std::vector< vpPoint > & | points | ) |
Get the 3D points of the clipped region of interest.
| points | : resulting points. |
Definition at line 414 of file vpPolygon3D.cpp.
References polyClipped.
| vpPolygon3D & vpPolygon3D::operator= | ( | const vpPolygon3D & | mbtp | ) |
Definition at line 66 of file vpPolygon3D.cpp.
References clippingFlag, distFarClip, distNearClip, nbCornersInsidePrev, nbpt, p, polyClipped, and vpPolygon3D().
Referenced by vpMbtPolygon::operator=().
|
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 625 of file vpPolygon3D.cpp.
|
inline |
Specify which clipping to use.
| flags | : New clipping flags. |
Definition at line 185 of file vpPolygon3D.h.
References clippingFlag.
Referenced by vpMbEdgeTracker::addLine(), vpMbtFaceDepthDense::addLine(), vpMbtFaceDepthNormal::addLine(), vpMbTracker::addProjectionErrorLine(), getClippedPolygon(), and vpMbEdgeTracker::setClipping().
|
inline |
Set the far distance for clipping.
| dist | : Far clipping value. |
Definition at line 192 of file vpPolygon3D.h.
References clippingFlag, distFarClip, and FAR_CLIPPING.
Referenced by vpMbEdgeTracker::addLine(), vpMbtFaceDepthDense::addLine(), vpMbtFaceDepthNormal::addLine(), vpMbTracker::addProjectionErrorLine(), getClippedPolygon(), and vpMbEdgeTracker::setFarClippingDistance().
|
virtual |
Set the number of points which are the corners of the polygon.
| nb | : The number of corners. |
Definition at line 115 of file vpPolygon3D.cpp.
Referenced by vpMbtFaceDepthDense::addLine(), vpMbtFaceDepthNormal::addLine(), vpMbTracker::addPolygon(), vpMbTracker::addPolygon(), vpMbTracker::addPolygon(), vpMbTracker::addPolygon(), vpMbTracker::addProjectionErrorPolygon(), vpMbTracker::addProjectionErrorPolygon(), vpMbTracker::addProjectionErrorPolygon(), vpMbTracker::addProjectionErrorPolygon(), and getClippedPolygon().
|
inline |
Set the near distance for clipping.
| dist | : Near clipping value. |
Definition at line 205 of file vpPolygon3D.h.
References clippingFlag, distNearClip, and NEAR_CLIPPING.
Referenced by vpMbEdgeTracker::addLine(), vpMbtFaceDepthDense::addLine(), vpMbtFaceDepthNormal::addLine(), vpMbTracker::addProjectionErrorLine(), getClippedPolygon(), and vpMbEdgeTracker::setNearClippingDistance().
| unsigned int vpPolygon3D::clippingFlag |
Clipping flag.
Definition at line 83 of file vpPolygon3D.h.
Referenced by computePolygonClipped(), getClipping(), vpMbtPolygon::isVisible(), operator=(), setClipping(), setFarClippingDistance(), setNearClippingDistance(), vpPolygon3D(), and vpPolygon3D().
| double vpPolygon3D::distFarClip |
Distance for near clipping.
Definition at line 87 of file vpPolygon3D.h.
Referenced by computePolygonClipped(), getFarClippingDistance(), operator=(), setFarClippingDistance(), vpPolygon3D(), and vpPolygon3D().
| double vpPolygon3D::distNearClip |
Distance for near clipping.
Definition at line 85 of file vpPolygon3D.h.
Referenced by computePolygonClipped(), getNearClippingDistance(), operator=(), setNearClippingDistance(), vpPolygon3D(), and vpPolygon3D().
| unsigned int vpPolygon3D::nbCornersInsidePrev |
Number of corners inside the image during the last call to getNbCornerInsideImage
Definition at line 77 of file vpPolygon3D.h.
Referenced by getNbCornerInsideImage(), getNbCornerInsidePrevImage(), operator=(), vpPolygon3D(), and vpPolygon3D().
| unsigned int vpPolygon3D::nbpt |
Number of points used to define the polygon.
Definition at line 74 of file vpPolygon3D.h.
Referenced by vpMbDepthDenseTracker::addFace(), vpMbDepthNormalTracker::addFace(), changeFrame(), computePolygonClipped(), getNbCornerInsideImage(), getNbPoint(), getPoint(), getRoi(), vpMbtPolygon::isVisible(), operator=(), setNbPoint(), vpPolygon3D(), and vpPolygon3D().
| vpPoint* vpPolygon3D::p |
corners in the object frame
Definition at line 79 of file vpPolygon3D.h.
Referenced by vpMbDepthDenseTracker::addFace(), vpMbDepthNormalTracker::addFace(), vpMbtFaceDepthDense::addLine(), vpMbtFaceDepthNormal::addLine(), addPoint(), changeFrame(), computePolygonClipped(), getNbCornerInsideImage(), getPoint(), getRoi(), vpMbEdgeTracker::initFaceFromCorners(), vpMbEdgeTracker::initFaceFromLines(), vpMbTracker::initProjectionErrorFaceFromCorners(), vpMbTracker::initProjectionErrorFaceFromLines(), vpMbtPolygon::isVisible(), operator=(), setNbPoint(), vpMbKltTracker::setPose(), vpPolygon3D(), vpPolygon3D(), and ~vpPolygon3D().
| std::vector<std::pair<vpPoint, unsigned int> > vpPolygon3D::polyClipped |
Region of interest clipped.
Definition at line 81 of file vpPolygon3D.h.
Referenced by computePolygonClipped(), getPolygonClipped(), getPolygonClipped(), getRoiClipped(), getRoiClipped(), getRoiClipped(), operator=(), vpPolygon3D(), and vpPolygon3D().