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 #ifdef VISP_HAVE_CPP11_COMPATIBILITY 104 CHECK_DEGENERATE_POINTS
119 std::vector<vpPoint> c3d;
121 bool computeCovariance;
126 unsigned int ransacNbInlierConsensus;
130 std::vector<vpPoint> ransacInliers;
132 std::vector<unsigned int> ransacInlierIndex;
134 double ransacThreshold;
137 double distanceToPlaneForCoplanarityTest;
142 std::vector<vpPoint> listOfPoints;
144 bool useParallelRansac;
146 int nbParallelRansacThreads;
155 RansacFunctor(
const vpHomogeneousMatrix &cMo_,
const unsigned int ransacNbInlierConsensus_,
156 const int ransacMaxTrials_,
const double ransacThreshold_,
const unsigned int initial_seed_,
157 const bool checkDegeneratePoints_,
const std::vector<vpPoint> &listOfUniquePoints_,
159 #ifdef VISP_HAVE_CPP11_COMPATIBILITY
160 , std::atomic<bool> &abort
164 #ifdef VISP_HAVE_CPP11_COMPATIBILITY 167 m_best_consensus(), m_checkDegeneratePoints(checkDegeneratePoints_), m_cMo(cMo_), m_foundSolution(
false),
168 m_func(func_), m_initial_seed(initial_seed_), m_listOfUniquePoints(listOfUniquePoints_), m_nbInliers(0),
169 m_ransacMaxTrials(ransacMaxTrials_), m_ransacNbInlierConsensus(ransacNbInlierConsensus_),
170 m_ransacThreshold(ransacThreshold_)
172 #if (defined(_WIN32) && (defined(_MSC_VER) || defined(__MINGW32__)) || defined(ANDROID)) 177 void operator()() { m_foundSolution = poseRansacImpl(); }
180 bool getResult()
const {
return m_foundSolution; }
182 std::vector<unsigned int> getBestConsensus()
const {
return m_best_consensus; }
186 unsigned int getNbInliers()
const {
return m_nbInliers; }
189 #ifdef VISP_HAVE_CPP11_COMPATIBILITY 190 std::atomic<bool> &m_abort;
192 std::vector<unsigned int> m_best_consensus;
193 bool m_checkDegeneratePoints;
195 bool m_foundSolution;
197 unsigned int m_initial_seed;
198 std::vector<vpPoint> m_listOfUniquePoints;
199 unsigned int m_nbInliers;
200 int m_ransacMaxTrials;
201 unsigned int m_ransacNbInlierConsensus;
202 double m_ransacThreshold;
204 bool poseRansacImpl();
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,
const bool useParallelRansac=
true,
const unsigned int nthreads=0,
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 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 what is a point.
double lambda
parameters use for the virtual visual servoing approach
int getNbParallelRansacThreads() const
unsigned int getRansacNbInliers() const
Class used for pose computation from N points (pose from point only). Some of the algorithms implemen...
void setNbParallelRansacThreads(const int nb)
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)
void setUseParallelRansac(const bool use)
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.
void setVvsEpsilon(const double eps)
std::vector< vpPoint > getRansacInliers() const
void setCovarianceComputation(const bool &flag)