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();
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
Class to define RGB colors available for display functionnalities.
static const vpColor none
error that can be emited by ViSP classes.
@ badValue
Used to indicate that a value is not in the allowed range.
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of a matrix and operations on matrices.
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Class used for pose computation from N points (pose from point only). Some of the algorithms implemen...
void setRansacMaxTrials(const int &rM)
void setRansacNbInliersToReachConsensus(const unsigned int &nbC)
vpMatrix getCovarianceMatrix() const
bool getUseParallelRansac() const
void setCovarianceComputation(const bool &flag)
unsigned int npt
Number of point used in pose computation.
int getNbParallelRansacThreads() const
std::vector< vpPoint > getPoints() const
std::vector< unsigned int > getRansacInlierIndex() const
std::list< vpPoint > listP
Array of point (use here class vpPoint)
void setRansacFilterFlag(const RANSAC_FILTER_FLAGS &flag)
void setVvsIterMax(int nb)
@ PREFILTER_DEGENERATE_POINTS
unsigned int getRansacNbInliers() const
void setUseParallelRansac(bool use)
std::vector< vpPoint > getRansacInliers() const
double lambda
parameters use for the virtual visual servoing approach
void setVvsEpsilon(const double eps)
void setNbParallelRansacThreads(int nb)
double residual
Residual in meter.
void setRansacThreshold(const double &t)
Class for generating random numbers with uniform probability density.