52 #include <visp3/core/vpHomogeneousMatrix.h> 53 #include <visp3/core/vpPoint.h> 54 #include <visp3/core/vpRGBa.h> 55 #include <visp3/vision/vpHomography.h> 56 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS 57 #include <visp3/core/vpList.h> 59 #include <visp3/core/vpThread.h> 104 PREFILTER_DUPLICATE_POINTS = 0x1,
105 PREFILTER_ALMOST_DUPLICATE_POINTS = 0x2,
108 PREFILTER_DEGENERATE_POINTS = 0x4,
111 CHECK_DEGENERATE_POINTS = 0x8
126 std::vector<vpPoint> c3d;
128 bool computeCovariance;
133 unsigned int ransacNbInlierConsensus;
137 std::vector<vpPoint> ransacInliers;
139 std::vector<unsigned int> ransacInlierIndex;
141 double ransacThreshold;
144 double distanceToPlaneForCoplanarityTest;
149 std::vector<vpPoint> listOfPoints;
151 bool useParallelRansac;
153 int nbParallelRansacThreads;
162 RansacFunctor(
const vpHomogeneousMatrix &cMo_,
const unsigned int ransacNbInlierConsensus_,
163 const int ransacMaxTrials_,
const double ransacThreshold_,
const unsigned int initial_seed_,
164 const bool checkDegeneratePoints_,
const std::vector<vpPoint> &listOfUniquePoints_,
166 : m_best_consensus(), m_checkDegeneratePoints(checkDegeneratePoints_), m_cMo(cMo_), m_foundSolution(
false),
167 m_func(func_), m_initial_seed(initial_seed_), m_listOfUniquePoints(listOfUniquePoints_), m_nbInliers(0),
168 m_ransacMaxTrials(ransacMaxTrials_), m_ransacNbInlierConsensus(ransacNbInlierConsensus_),
169 m_ransacThreshold(ransacThreshold_)
174 : m_best_consensus(), m_checkDegeneratePoints(
false), m_cMo(), m_foundSolution(
false), m_func(NULL),
175 m_initial_seed(0), m_listOfUniquePoints(), m_nbInliers(0), m_ransacMaxTrials(), m_ransacNbInlierConsensus(),
180 void operator()() { m_foundSolution = poseRansacImpl(); }
183 bool getResult()
const {
return m_foundSolution; }
185 std::vector<unsigned int> getBestConsensus()
const {
return m_best_consensus; }
189 unsigned int getNbInliers()
const {
return m_nbInliers; }
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();
207 #if defined(VISP_HAVE_PTHREAD) || (defined(_WIN32) && !defined(WINRT_8_0)) 220 void addPoint(
const vpPoint &P);
221 void addPoints(
const std::vector<vpPoint> &lP);
226 bool coplanar(
int &coplanar_plane_type);
239 void setDistanceToPlaneForCoplanarityTest(
double d);
255 if (t > std::numeric_limits<double>::epsilon()) {
285 if (!computeCovariance)
286 vpTRACE(
"Warning : The covariance matrix has not been computed. See " 287 "setCovarianceComputation() to do it.");
289 return covarianceMatrix;
338 std::vector<vpPoint> vectorOfPoints(listP.begin(), listP.end());
339 return vectorOfPoints;
349 static int computeRansacIterations(
double probability,
double epsilon,
const int sampleSize = 4,
350 int maxIterations = 2000);
352 static void findMatch(std::vector<vpPoint> &p2D, std::vector<vpPoint> &p3D,
353 const unsigned int &numberOfInlierToReachAConsensus,
const double &threshold,
355 const int &maxNbTrials = 10000);
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
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.
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)
unsigned int getRansacNbInliers() const
Implementation of column vector and the associated operations.
void setRansacFilterFlags(const int flags)
vpPoseMethodType
Methods that could be used to estimate the pose from points.
void setVvsEpsilon(const double eps)
void setCovarianceComputation(const bool &flag)