51 #include <visp3/core/vpHomogeneousMatrix.h>
52 #include <visp3/vision/vpHomography.h>
53 #include <visp3/core/vpPoint.h>
54 #include <visp3/core/vpRGBa.h>
55 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
56 # include <visp3/core/vpList.h>
58 #include <visp3/core/vpThread.h>
94 PREFILTER_DUPLICATE_POINTS = 0x1,
95 PREFILTER_ALMOST_DUPLICATE_POINTS = 0x2,
96 PREFILTER_DEGENERATE_POINTS = 0x4,
97 CHECK_DEGENERATE_POINTS = 0x8
110 std::vector<vpPoint> c3d ;
113 bool computeCovariance;
117 unsigned int ransacNbInlierConsensus;
119 std::vector<vpPoint> ransacInliers;
120 std::vector<unsigned int> ransacInlierIndex;
121 double ransacThreshold;
122 double distanceToPlaneForCoplanarityTest;
124 std::vector<vpPoint> listOfPoints;
125 bool useParallelRansac;
126 int nbParallelRansacThreads;
130 class RansacFunctor {
133 const unsigned int ransacNbInlierConsensus_,
const int ransacMaxTrials_,
134 const double ransacThreshold_,
const unsigned int initial_seed_,
135 const bool checkDegeneratePoints_,
const std::vector<vpPoint> &listOfUniquePoints_,
137 m_best_consensus(), m_checkDegeneratePoints(checkDegeneratePoints_), m_cMo(cMo_), m_foundSolution(
false),
138 m_func(func_), m_initial_seed(initial_seed_), m_listOfUniquePoints(listOfUniquePoints_), m_nbInliers(0),
139 m_ransacMaxTrials(ransacMaxTrials_), m_ransacNbInlierConsensus(ransacNbInlierConsensus_), m_ransacThreshold(ransacThreshold_) {
143 m_best_consensus(),m_checkDegeneratePoints(
false), m_cMo(), m_foundSolution(
false), m_func(NULL),
144 m_initial_seed(0), m_listOfUniquePoints(), m_nbInliers(0), m_ransacMaxTrials(), m_ransacNbInlierConsensus(),
145 m_ransacThreshold() {
149 m_foundSolution = poseRansacImpl();
153 bool getResult()
const {
154 return m_foundSolution;
157 std::vector<unsigned int> getBestConsensus()
const {
158 return m_best_consensus;
165 unsigned int getNbInliers()
const {
170 std::vector<unsigned int> m_best_consensus;
171 bool m_checkDegeneratePoints;
173 bool m_foundSolution;
175 unsigned int m_initial_seed;
176 std::vector<vpPoint> m_listOfUniquePoints;
177 unsigned int m_nbInliers;
178 int m_ransacMaxTrials;
179 unsigned int m_ransacNbInlierConsensus;
180 double m_ransacThreshold;
182 bool poseRansacImpl();
185 #if defined(VISP_HAVE_PTHREAD) || (defined(_WIN32) && !defined(WINRT_8_0))
199 void addPoint(
const vpPoint& P) ;
200 void addPoints(
const std::vector<vpPoint>& lP);
205 bool coplanar(
int &coplanar_plane_type) ;
222 void setDistanceToPlaneForCoplanarityTest(
double d) ;
255 if(!computeCovariance)
256 vpTRACE(
"Warning : The covariance matrix has not been computed. See setCovarianceComputation() to do it.");
258 return covarianceMatrix;
277 return nbParallelRansacThreads;
288 nbParallelRansacThreads = nb;
297 return useParallelRansac;
306 useParallelRansac = use;
315 std::vector<vpPoint> vectorOfPoints(listP.begin(), listP.end());
316 return vectorOfPoints;
330 static int computeRansacIterations(
double probability,
double epsilon,
331 const int sampleSize=4,
int maxIterations=2000);
333 static void findMatch(std::vector<vpPoint> &p2D,
334 std::vector<vpPoint> &p3D,
335 const unsigned int &numberOfInlierToReachAConsensus,
336 const double &threshold,
337 unsigned int &ninliers,
338 std::vector<vpPoint> &listInliers,
340 const int &maxNbTrials = 10000);
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 setRansacFilterFlags(const int flags)
std::vector< vpPoint > getRansacInliers() const
void setCovarianceComputation(const bool &flag)