#include <vpPose.h>
|
enum | vpPoseMethodType {
LAGRANGE,
DEMENTHON,
LOWE,
RANSAC,
LAGRANGE_LOWE,
DEMENTHON_LOWE,
VIRTUAL_VS,
DEMENTHON_VIRTUAL_VS,
LAGRANGE_VIRTUAL_VS
} |
|
enum | RANSAC_FILTER_FLAGS { NO_FILTER,
PREFILTER_DEGENERATE_POINTS,
CHECK_DEGENERATE_POINTS
} |
|
|
static void | display (vpImage< unsigned char > &I, vpHomogeneousMatrix &cMo, vpCameraParameters &cam, double size, vpColor col=vpColor::none) |
|
static void | display (vpImage< vpRGBa > &I, vpHomogeneousMatrix &cMo, vpCameraParameters &cam, double size, vpColor col=vpColor::none) |
|
static double | poseFromRectangle (vpPoint &p1, vpPoint &p2, vpPoint &p3, vpPoint &p4, double lx, vpCameraParameters &cam, vpHomogeneousMatrix &cMo) |
|
static int | computeRansacIterations (double probability, double epsilon, const int sampleSize=4, int maxIterations=2000) |
|
static void | findMatch (std::vector< vpPoint > &p2D, std::vector< vpPoint > &p3D, const unsigned int &numberOfInlierToReachAConsensus, const double &threshold, unsigned int &ninliers, std::vector< vpPoint > &listInliers, vpHomogeneousMatrix &cMo, const int &maxNbTrials=10000, const bool useParallelRansac=true, const unsigned int nthreads=0, bool(*func)(const vpHomogeneousMatrix &)=NULL) |
|
Class used for pose computation from N points (pose from point only). Some of the algorithms implemented in this class are described in [Marchand16a].
- Note
- It is also possible to estimate a pose from other features using vpPoseFeatures class.
To see how to use this class you can follow the Tutorial: Pose estimation from points.
- Examples
- AROgre.cpp, AROgreBasic.cpp, poseVirtualVS.cpp, servoAfma62DhalfCamVelocity.cpp, servoAfma6FourPoints2DCamVelocityInteractionCurrent.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, servoViper650FourPoints2DArtVelocityInteractionCurrent.cpp, servoViper650FourPoints2DCamVelocityInteractionCurrent-SR300.cpp, servoViper650FourPoints2DCamVelocityInteractionCurrent.cpp, servoViper850FourPoints2DArtVelocityInteractionCurrent.cpp, servoViper850FourPoints2DCamVelocityInteractionCurrent.cpp, servoViper850FourPointsKinect.cpp, testKeyPoint-4.cpp, testPose.cpp, testPoseRansac.cpp, testPoseRansac2.cpp, testRobotAfma6Pose.cpp, testRobotViper850Pose.cpp, and tutorial-chessboard-pose.cpp.
Definition at line 77 of file vpPose.h.
◆ RANSAC_FILTER_FLAGS
Enumerator |
---|
NO_FILTER | |
PREFILTER_DEGENERATE_POINTS | Remove degenerate points (same 3D or 2D coordinates) before the RANSAC.
|
CHECK_DEGENERATE_POINTS | Check for degenerate points during the RANSAC.
|
Definition at line 100 of file vpPose.h.
◆ vpPoseMethodType
Methods that could be used to estimate the pose from points.
Enumerator |
---|
LAGRANGE | Linear Lagrange approach (doesn't need an initialization)
|
DEMENTHON | Linear Dementhon aproach (doesn't need an initialization)
|
LOWE | Lowe aproach based on a Levenberg Marquartd non linear minimization scheme that needs an initialization from Lagrange or Dementhon aproach
|
RANSAC | Robust Ransac aproach (doesn't need an initialization)
|
LAGRANGE_LOWE | Non linear Lowe aproach initialized by Lagrange approach
|
DEMENTHON_LOWE | Non linear Lowe aproach initialized by Dementhon approach
|
VIRTUAL_VS | Non linear virtual visual servoing approach that needs an initialization from Lagrange or Dementhon aproach
|
DEMENTHON_VIRTUAL_VS | Non linear virtual visual servoing approach initialized by Dementhon approach
|
LAGRANGE_VIRTUAL_VS | Non linear virtual visual servoing approach initialized by Lagrange approach
|
Definition at line 81 of file vpPose.h.
◆ vpPose()
Default constructor.
Definition at line 93 of file vpPose.cpp.
◆ ~vpPose()
Destructor that deletes the array of point (freed the memory).
Definition at line 106 of file vpPose.cpp.
◆ addPoint()
void vpPose::addPoint |
( |
const vpPoint & |
newP | ) |
|
Add a new point in the array of points.
- Parameters
-
newP | : New point to add in the array of point. |
- Warning
- Considering a point from the class vpPoint, oX, oY, and oZ will represent the 3D coordinates of the point in the object frame and x and y its 2D coordinates in the image plane. These 5 fields must be initialized to be used within this function.
- Examples
- AROgre.cpp, AROgreBasic.cpp, poseVirtualVS.cpp, servoAfma62DhalfCamVelocity.cpp, servoAfma6FourPoints2DCamVelocityInteractionCurrent.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, servoViper650FourPoints2DArtVelocityInteractionCurrent.cpp, servoViper650FourPoints2DCamVelocityInteractionCurrent-SR300.cpp, servoViper650FourPoints2DCamVelocityInteractionCurrent.cpp, servoViper850FourPoints2DArtVelocityInteractionCurrent.cpp, servoViper850FourPoints2DCamVelocityInteractionCurrent.cpp, servoViper850FourPointsKinect.cpp, testKeyPoint-4.cpp, testPose.cpp, testPoseRansac.cpp, testPoseRansac2.cpp, testRobotAfma6Pose.cpp, and testRobotViper850Pose.cpp.
Definition at line 136 of file vpPose.cpp.
◆ addPoints()
void vpPose::addPoints |
( |
const std::vector< vpPoint > & |
lP | ) |
|
Add (append) a list of points in the array of points.
- Parameters
-
lP | : List of points to add (append). |
- Warning
- Considering a point from the class vpPoint, oX, oY, and oZ will represent the 3D coordinates of the point in the object frame and x and y its 2D coordinates in the image plane. These 5 fields must be initialized to be used within this function.
- Examples
- testPoseRansac2.cpp, and tutorial-chessboard-pose.cpp.
Definition at line 151 of file vpPose.cpp.
◆ calculArbreDementhon()
◆ clearPoint()
void vpPose::clearPoint |
( |
| ) |
|
◆ computePose()
Compute the pose according to the desired method which are:
- vpPose::LAGRANGE: Linear Lagrange approach (test is done to switch between planar and non planar algorithm)
- vpPose::DEMENTHON: Linear Dementhon approach (test is done to switch between planar and non planar algorithm)
- vpPose::LOWE: Lowe aproach based on a Levenberg Marquartd non linear minimization scheme that needs an initialization from Lagrange or Dementhon aproach
- vpPose::LAGRANGE_LOWE: Non linear Lowe aproach initialized by Lagrange approach
- vpPose::DEMENTHON_LOWE: Non linear Lowe aproach initialized by Dementhon approach
- vpPose::VIRTUAL_VS: Non linear virtual visual servoing approach that needs an initialization from Lagrange or Dementhon aproach
- vpPose::DEMENTHON_VIRTUAL_VS: Non linear virtual visual servoing approach initialized by Dementhon approach
- vpPose::LAGRANGE_VIRTUAL_VS: Non linear virtual visual servoing approach initialized by Lagrange approach
- vpPose::RANSAC: Robust Ransac aproach (doesn't need an initialization)
- Examples
- AROgre.cpp, AROgreBasic.cpp, poseVirtualVS.cpp, servoAfma62DhalfCamVelocity.cpp, servoAfma6FourPoints2DCamVelocityInteractionCurrent.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, servoViper650FourPoints2DArtVelocityInteractionCurrent.cpp, servoViper650FourPoints2DCamVelocityInteractionCurrent-SR300.cpp, servoViper650FourPoints2DCamVelocityInteractionCurrent.cpp, servoViper850FourPoints2DArtVelocityInteractionCurrent.cpp, servoViper850FourPoints2DCamVelocityInteractionCurrent.cpp, servoViper850FourPointsKinect.cpp, testKeyPoint-4.cpp, testPose.cpp, testPoseRansac.cpp, testPoseRansac2.cpp, testRobotAfma6Pose.cpp, testRobotViper850Pose.cpp, and tutorial-chessboard-pose.cpp.
Definition at line 361 of file vpPose.cpp.
◆ computeRansacIterations()
int vpPose::computeRansacIterations |
( |
double |
probability, |
|
|
double |
epsilon, |
|
|
const int |
sampleSize = 4 , |
|
|
int |
maxIterations = 2000 |
|
) |
| |
|
static |
Compute the number of RANSAC iterations to ensure with a probability p that at least one of the random samples of s points is free from outliers.
- Note
- See: Hartley and Zisserman, Multiple View Geometry in Computer Vision, p119 (2. How many samples?).
- Parameters
-
probability | : Probability that at least one of the random samples is free from outliers (typically p=0.99). |
epsilon | : Probability that a selected point is an outlier (between 0 and 1). |
sampleSize | : Minimum number of points to estimate the model (4 for a pose estimation). |
maxIterations | : Upper bound on the number of iterations or -1 for INT_MAX. |
- Returns
- The number of RANSAC iterations to ensure with a probability p that at least one of the random samples of s points is free from outliers or
maxIterations
if it exceeds the desired upper bound or INT_MAX if maxIterations=-1.
- Examples
- testPoseRansac2.cpp.
Definition at line 603 of file vpPoseRansac.cpp.
◆ computeResidual()
◆ computeResidualDementhon()
Compute and return the residual corresponding to the sum of squared residuals in meter^2 for the pose matrix cMo.
- Parameters
-
cMo | : the matrix that defines the pose to be tested. |
- Returns
- the value of the sum of squared residuals in meter^2.
Definition at line 545 of file vpPoseDementhon.cpp.
◆ coplanar()
bool vpPose::coplanar |
( |
int & |
coplanar_plane_type | ) |
|
Test the coplanarity of the set of points
- Parameters
-
coplanar_plane_type | 1: if plane x=cst 2: if plane y=cst 3: if plane z=cst 4: if the points are collinear. 0: any other plane |
- Returns
- true if points are coplanar false otherwise.
Definition at line 171 of file vpPose.cpp.
◆ display() [1/2]
Display in the image I the pose represented by its homogenous transformation cMo as a 3 axis frame.
- Parameters
-
I | Image where the pose is displayed in overlay. |
cMo | Considered pose to display. |
cam | Camera parameters associated to image I. |
size | length in meter of the axis that will be displayed |
col | Color used to display the 3 axis. If vpColor::none, red, green and blue will represent x-axiw, y-axis and z-axis respectively. |
- Examples
- AROgre.cpp, AROgreBasic.cpp, and poseVirtualVS.cpp.
Definition at line 476 of file vpPose.cpp.
◆ display() [2/2]
Display in the image I the pose represented by its homogenous transformation cMo as a 3 axis frame.
- Parameters
-
I | Image where the pose is displayed in overlay. |
cMo | Considered pose to display. |
cam | Camera parameters associated to image I. |
size | length in meter of the axis that will be displayed |
col | Color used to display the 3 axis. If vpColor::none, red, green and blue will represent x-axiw, y-axis and z-axis respectively. |
Definition at line 491 of file vpPose.cpp.
◆ displayModel() [1/2]
Display the coordinates of the points in the image plane that are used to compute the pose in image I.
Definition at line 500 of file vpPose.cpp.
◆ displayModel() [2/2]
Display the coordinates of the points in the image plane that are used to compute the pose in image I.
Definition at line 518 of file vpPose.cpp.
◆ findMatch()
void vpPose::findMatch |
( |
std::vector< vpPoint > & |
p2D, |
|
|
std::vector< vpPoint > & |
p3D, |
|
|
const unsigned int & |
numberOfInlierToReachAConsensus, |
|
|
const double & |
threshold, |
|
|
unsigned int & |
ninliers, |
|
|
std::vector< vpPoint > & |
listInliers, |
|
|
vpHomogeneousMatrix & |
cMo, |
|
|
const int & |
maxNbTrials = 10000 , |
|
|
const bool |
useParallelRansac = true , |
|
|
const unsigned int |
nthreads = 0 , |
|
|
bool(*)(const vpHomogeneousMatrix &) |
func = NULL |
|
) |
| |
|
static |
Match a vector p2D of 2D point (x,y) and a vector p3D of 3D points (X,Y,Z) using the Ransac algorithm.
At least numberOfInlierToReachAConsensus of true correspondance are required to validate the pose
The inliers are given in a vector of vpPoint listInliers.
The pose is returned in cMo.
- Parameters
-
p2D | : Vector of 2d points (x and y attributes are used). |
p3D | : Vector of 3d points (oX, oY and oZ attributes are used). |
numberOfInlierToReachAConsensus | : The minimum number of inlier to have to consider a trial as correct. |
threshold | : The maximum error allowed between the 2d points and the reprojection of its associated 3d points by the current pose (in meter). |
ninliers | : Number of inliers found for the best solution. |
listInliers | : Vector of points (2d and 3d) that are inliers for the best solution. |
cMo | : The computed pose (best solution). |
maxNbTrials | : Maximum number of trials before considering a solution fitting the required numberOfInlierToReachAConsensus and threshold cannot be found. |
useParallelRansac | : If true, use parallel RANSAC version (if C++11 is available). |
nthreads | : Number of threads to use, if 0 the number of CPU threads will be determined. |
func | : Pointer to a function that takes in parameter a vpHomogeneousMatrix and returns true if the pose check is OK or false otherwise |
- Examples
- testFindMatch.cpp.
Definition at line 671 of file vpPoseRansac.cpp.
◆ getCovarianceMatrix()
vpMatrix vpPose::getCovarianceMatrix |
( |
| ) |
const |
|
inline |
Get the covariance matrix computed in the Virtual Visual Servoing approach.
- Warning
- The compute covariance flag has to be true if you want to compute the covariance matrix.
- See also
- setCovarianceComputation
Definition at line 278 of file vpPose.h.
◆ getNbParallelRansacThreads()
int vpPose::getNbParallelRansacThreads |
( |
| ) |
const |
|
inline |
◆ getPoints()
std::vector<vpPoint> vpPose::getPoints |
( |
| ) |
const |
|
inline |
Get the vector of points.
- Returns
- The vector of points.
Definition at line 336 of file vpPose.h.
◆ getRansacInlierIndex()
std::vector<unsigned int> vpPose::getRansacInlierIndex |
( |
| ) |
const |
|
inline |
◆ getRansacInliers()
std::vector<vpPoint> vpPose::getRansacInliers |
( |
| ) |
const |
|
inline |
◆ getRansacNbInliers()
unsigned int vpPose::getRansacNbInliers |
( |
| ) |
const |
|
inline |
◆ getUseParallelRansac()
bool vpPose::getUseParallelRansac |
( |
| ) |
const |
|
inline |
- Returns
- True if the parallel RANSAC version should be used (depends also to C++11 availability).
- See also
- setUseParallelRansac
Definition at line 322 of file vpPose.h.
◆ init()
void vpPose::init |
( |
void |
| ) |
|
Basic initialisation that is called by the constructors.
Definition at line 61 of file vpPose.cpp.
◆ poseDementhonNonPlan()
Compute the pose using Dementhon approach for non planar objects. This is a direct implementation of the algorithm proposed by Dementhon and Davis in their 1995 paper [Dementhon95].
Definition at line 107 of file vpPoseDementhon.cpp.
◆ poseDementhonPlan()
Compute the pose using Dementhon approach for planar objects this is a direct implementation of the algorithm proposed by Dementhon in his PhD.
- Author
- Francois Chaumette (simplified by Eric Marchand)
Definition at line 420 of file vpPoseDementhon.cpp.
◆ poseFromRectangle()
Carries out the camera pose the image of a rectangle and the intrinsec parameters, the length on x axis is known but the proprtion of the rectangle are unknown.
This method is taken from "Markerless Tracking using Planar Structures
in the Scene" by Gilles Simon. The idea is to compute the homography H giving the image point of the rectangle by associating them with the coordinates (0,0)(1,0)(1,1/s)(0,1/s) (the rectangle is on the Z=0 plane). If K is the intrinsec parameters matrix, we have s = ||Kh1||/ ||Kh2||. s gives us the proportion of the rectangle
- Parameters
-
p1,p2,p3,p4 | the image of the corners of the rectangle (respectively the image of (0,0),(lx,0),(lx,lx/s) and (0,lx/s)) (input) |
cam | the camera used (input) |
lx | the rectangle size on the x axis (input) |
cMo | the camera pose (output) |
- Returns
- int : OK if no pb occurs
Definition at line 551 of file vpPose.cpp.
◆ poseLagrangeNonPlan()
◆ poseLagrangePlan()
Compute the pose of a planar object using Lagrange approach.
- Parameters
-
cMo | : Estimated pose. No initialisation is requested to estimate cMo. |
Definition at line 255 of file vpPoseLagrange.cpp.
◆ poseLowe()
Compute the pose using the Lowe non linear approach it consider the minimization of a residual using the levenberg marquartd approach.
The approach has been proposed by D.G Lowe in 1992 paper [Lowe92a].
Definition at line 261 of file vpPoseLowe.cpp.
◆ poseRansac()
Compute the pose using the Ransac approach.
- Parameters
-
cMo | : Computed pose |
func | : Pointer to a function that takes in parameter a vpHomogeneousMatrix and returns true if the pose check is OK or false otherwise |
- Returns
- True if we found at least 4 points with a reprojection error below ransacThreshold.
- Note
- You can enable a multithreaded version if you have C++11 enabled using setUseParallelRansac The number of threads used can then be set with setNbParallelRansacThreads Filter flag can be used with setRansacFilterFlag
Definition at line 331 of file vpPoseRansac.cpp.
◆ poseVirtualVS()
◆ poseVirtualVSrobust()
Compute the pose using virtual visual servoing approach and a robust control law.
This approach is described in [Comport06b].
Definition at line 160 of file vpPoseVirtualVisualServoing.cpp.
◆ printPoint()
void vpPose::printPoint |
( |
| ) |
|
◆ setCovarianceComputation()
void vpPose::setCovarianceComputation |
( |
const bool & |
flag | ) |
|
|
inline |
Set if the covariance matrix has to be computed in the Virtual Visual Servoing approach.
- Parameters
-
flag | : True if the covariance has to be computed, false otherwise. |
Definition at line 267 of file vpPose.h.
◆ setDistanceToPlaneForCoplanarityTest()
void vpPose::setDistanceToPlaneForCoplanarityTest |
( |
double |
d | ) |
|
◆ setLambda()
void vpPose::setLambda |
( |
double |
a | ) |
|
|
inline |
◆ setNbParallelRansacThreads()
void vpPose::setNbParallelRansacThreads |
( |
const int |
nb | ) |
|
|
inline |
Set the number of threads for the parallel RANSAC implementation.
- Note
- You have to enable the parallel version with setUseParallelRansac(). If the number of threads is 0, the number of threads to use is automatically determined with C++11.
- See also
- setUseParallelRansac
Definition at line 315 of file vpPose.h.
◆ setRansacFilterFlag()
Set RANSAC filter flag.
- Parameters
-
flag | : RANSAC flag to use to prefilter or perform degenerate configuration check. |
- See also
- RANSAC_FILTER_FLAGS
- Warning
- Prefilter degenerate points consists to not add subsequent degenerate points. This means that it is possible to discard a valid point and keep an invalid point if the invalid point is added first. It is faster to prefilter for duplicate points instead of checking for degenerate configuration at each time.
- Note
- By default the flag is set to NO_FILTER.
- Examples
- testPoseRansac2.cpp.
Definition at line 298 of file vpPose.h.
◆ setRansacMaxTrials()
void vpPose::setRansacMaxTrials |
( |
const int & |
rM | ) |
|
|
inline |
◆ setRansacNbInliersToReachConsensus()
void vpPose::setRansacNbInliersToReachConsensus |
( |
const unsigned int & |
nbC | ) |
|
|
inline |
◆ setRansacThreshold()
void vpPose::setRansacThreshold |
( |
const double & |
t | ) |
|
|
inline |
◆ setUseParallelRansac()
void vpPose::setUseParallelRansac |
( |
const bool |
use | ) |
|
|
inline |
Set if parallel RANSAC version should be used or not (only if C++11).
- Note
- Need C++11.
- Examples
- testPoseRansac2.cpp.
Definition at line 329 of file vpPose.h.
◆ setVvsEpsilon()
void vpPose::setVvsEpsilon |
( |
const double |
eps | ) |
|
|
inline |
◆ setVvsIterMax()
void vpPose::setVvsIterMax |
( |
int |
nb | ) |
|
|
inline |
◆ lambda
parameters use for the virtual visual servoing approach
Definition at line 112 of file vpPose.h.
◆ listP
◆ npt
◆ residual
Residual in meter.
Definition at line 109 of file vpPose.h.