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_,
161 #
if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
162 , std::atomic<bool> &abort
166 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) 169 m_best_consensus(), m_checkDegeneratePoints(checkDegeneratePoints_), m_cMo(cMo_), m_foundSolution(
false),
170 m_func(func_), m_listOfUniquePoints(listOfUniquePoints_), m_nbInliers(0),
171 m_ransacMaxTrials(ransacMaxTrials_), m_ransacNbInlierConsensus(ransacNbInlierConsensus_),
172 m_ransacThreshold(ransacThreshold_), m_uniRand(initial_seed_)
176 void operator()() { m_foundSolution = poseRansacImpl(); }
179 bool getResult()
const {
return m_foundSolution; }
181 std::vector<unsigned int> getBestConsensus()
const {
return m_best_consensus; }
185 unsigned int getNbInliers()
const {
return m_nbInliers; }
188 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) 189 std::atomic<bool> &m_abort;
191 std::vector<unsigned int> m_best_consensus;
192 bool m_checkDegeneratePoints;
194 bool m_foundSolution;
196 std::vector<vpPoint> m_listOfUniquePoints;
197 unsigned int m_nbInliers;
198 int m_ransacMaxTrials;
199 unsigned int m_ransacNbInlierConsensus;
200 double m_ransacThreshold;
203 bool poseRansacImpl();
214 vpPose(
const std::vector<vpPoint>& lP);
216 void addPoint(
const vpPoint &P);
217 void addPoints(
const std::vector<vpPoint> &lP);
222 bool coplanar(
int &coplanar_plane_type);
235 void setDistanceToPlaneForCoplanarityTest(
double d);
251 if (t > std::numeric_limits<double>::epsilon()) {
281 if (!computeCovariance)
282 vpTRACE(
"Warning : The covariance matrix has not been computed. See " 283 "setCovarianceComputation() to do it.");
285 return covarianceMatrix;
339 std::vector<vpPoint> vectorOfPoints(listP.begin(), listP.end());
340 return vectorOfPoints;
350 static int computeRansacIterations(
double probability,
double epsilon,
const int sampleSize = 4,
351 int maxIterations = 2000);
353 static void findMatch(std::vector<vpPoint> &p2D, std::vector<vpPoint> &p3D,
354 const unsigned int &numberOfInlierToReachAConsensus,
const double &threshold,
356 const int &maxNbTrials=10000,
bool useParallelRansac=
true,
unsigned int nthreads=0,
359 static bool computePlanarObjectPoseFromRGBD(
const vpImage<float> &depthMap,
const std::vector<vpImagePoint> &corners,
361 double *confidence_index = NULL);
363 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) 368 vp_deprecated
void init();
Used to indicate that a value is not in the allowed range.
Implementation of a matrix and operations on matrices.
double residual
Residual in meter.
std::vector< unsigned int > getRansacInlierIndex() const
std::vector< vpPoint > getPoints() const
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class to define colors available for display functionnalities.
bool getUseParallelRansac() const
static const vpColor none
error that can be emited by ViSP classes.
void setRansacThreshold(const double &t)
std::list< vpPoint > listP
Array of point (use here class vpPoint)
std::vector< vpPoint > getRansacInliers() const
Class that defines what is a point.
double lambda
parameters use for the virtual visual servoing approach
vpMatrix getCovarianceMatrix() const
int getNbParallelRansacThreads() const
void setNbParallelRansacThreads(int nb)
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.
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)
unsigned int getRansacNbInliers() const
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)
void setCovarianceComputation(const bool &flag)