49 #include <visp3/core/vpHomogeneousMatrix.h> 50 #include <visp3/core/vpPoint.h> 51 #include <visp3/core/vpRGBa.h> 52 #include <visp3/vision/vpHomography.h> 53 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS 54 #include <visp3/core/vpList.h> 56 #include <visp3/core/vpThread.h> 61 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) 65 #include <visp3/core/vpUniRand.h> 106 CHECK_DEGENERATE_POINTS
121 std::vector<vpPoint> c3d;
123 bool computeCovariance;
128 unsigned int ransacNbInlierConsensus;
132 std::vector<vpPoint> ransacInliers;
134 std::vector<unsigned int> ransacInlierIndex;
136 double ransacThreshold;
139 double distanceToPlaneForCoplanarityTest;
144 std::vector<vpPoint> listOfPoints;
146 bool useParallelRansac;
148 int nbParallelRansacThreads;
158 const int ransacMaxTrials_,
double ransacThreshold_,
unsigned int initial_seed_,
159 bool checkDegeneratePoints_,
const std::vector<vpPoint> &listOfUniquePoints_,
162 m_best_consensus(), m_checkDegeneratePoints(checkDegeneratePoints_), m_cMo(cMo_), m_foundSolution(
false),
163 m_func(func_), m_listOfUniquePoints(listOfUniquePoints_), m_nbInliers(0),
164 m_ransacMaxTrials(ransacMaxTrials_), m_ransacNbInlierConsensus(ransacNbInlierConsensus_),
165 m_ransacThreshold(ransacThreshold_), m_uniRand(initial_seed_)
169 void operator()() { m_foundSolution = poseRansacImpl(); }
172 bool getResult()
const {
return m_foundSolution; }
174 std::vector<unsigned int> getBestConsensus()
const {
return m_best_consensus; }
178 unsigned int getNbInliers()
const {
return m_nbInliers; }
181 std::vector<unsigned int> m_best_consensus;
182 bool m_checkDegeneratePoints;
184 bool m_foundSolution;
186 std::vector<vpPoint> m_listOfUniquePoints;
187 unsigned int m_nbInliers;
188 int m_ransacMaxTrials;
189 unsigned int m_ransacNbInlierConsensus;
190 double m_ransacThreshold;
193 bool poseRansacImpl();
204 vpPose(
const std::vector<vpPoint>& lP);
206 void addPoint(
const vpPoint &P);
207 void addPoints(
const std::vector<vpPoint> &lP);
212 bool coplanar(
int &coplanar_plane_type);
225 void setDistanceToPlaneForCoplanarityTest(
double d);
241 if (t > std::numeric_limits<double>::epsilon()) {
271 if (!computeCovariance)
272 vpTRACE(
"Warning : The covariance matrix has not been computed. See " 273 "setCovarianceComputation() to do it.");
275 return covarianceMatrix;
329 std::vector<vpPoint> vectorOfPoints(listP.begin(), listP.end());
330 return vectorOfPoints;
340 static int computeRansacIterations(
double probability,
double epsilon,
const int sampleSize = 4,
341 int maxIterations = 2000);
343 static void findMatch(std::vector<vpPoint> &p2D, std::vector<vpPoint> &p3D,
344 const unsigned int &numberOfInlierToReachAConsensus,
const double &threshold,
346 const int &maxNbTrials=10000,
bool useParallelRansac=
true,
unsigned int nthreads=0,
349 static bool computePlanarObjectPoseFromRGBD(
const vpImage<float> &depthMap,
const std::vector<vpImagePoint> &corners,
351 double *confidence_index = NULL);
353 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) 358 vp_deprecated
void init();
Used to indicate that a value is not in the allowed range.
Implementation of a matrix and operations on matrices.
std::vector< vpPoint > getPoints() const
double residual
Residual in meter.
bool getUseParallelRansac() const
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class to define RGB colors available for display functionnalities.
static const vpColor none
error that can be emited by ViSP classes.
void setRansacThreshold(const double &t)
std::vector< unsigned int > getRansacInlierIndex() const
std::list< vpPoint > listP
Array of point (use here class vpPoint)
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
double lambda
parameters use for the virtual visual servoing approach
int getNbParallelRansacThreads() const
void setNbParallelRansacThreads(int nb)
unsigned int getRansacNbInliers() const
void setUseParallelRansac(bool use)
Class used for pose computation from N points (pose from point only). Some of the algorithms implemen...
Generic class defining intrinsic camera parameters.
vpMatrix getCovarianceMatrix() const
void setVvsIterMax(int nb)
unsigned int npt
Number of point used in pose computation.
void setRansacMaxTrials(const int &rM)
void setRansacNbInliersToReachConsensus(const unsigned int &nbC)
Implementation of column vector and the associated operations.
void setRansacFilterFlag(const RANSAC_FILTER_FLAGS &flag)
vpPoseMethodType
Methods that could be used to estimate the pose from points.
Class for generating random numbers with uniform probability density.
void setVvsEpsilon(const double eps)
std::vector< vpPoint > getRansacInliers() const
void setCovarianceComputation(const bool &flag)