40 #include <visp3/vision/vpPose.h>
41 #include <visp3/core/vpPoint.h>
42 #include <visp3/core/vpMath.h>
43 #include <visp3/core/vpHomogeneousMatrix.h>
62 std::cout <<
"Find Matches using Ransac" << std::endl;
63 std::vector<vpPoint> P;
65 P.push_back(
vpPoint(-L,-L, 0 ) );
66 P.push_back(
vpPoint(L,-L, 0 ) );
67 P.push_back(
vpPoint(L,L, 0 ) );
68 P.push_back(
vpPoint(-L,L, 0 ) );
69 P.push_back(
vpPoint(-0,L/2., L ) );
73 std::vector<vpPoint> p( P.size() );
74 for(
unsigned int i=0 ; i < P.size() ; i++)
78 p[i].set_x(pt.
get_x());
79 p[i].set_y(pt.
get_y());
82 unsigned int ninliers ;
83 std::vector<vpPoint> inliers;
84 double threshold = 1e-6;
85 unsigned int nbInlierToReachConsensus = (
unsigned int)(P.size());
91 std::cout <<
"Inliers: " << std::endl;
92 for (
unsigned int i = 0; i < inliers.size() ; i++)
95 std::cout << std::endl;
98 std::cout <<
"cMo :\n" <<
vpPoseVector(cMo).
t() << std::endl << std::endl;
103 std::cout << std::endl;
104 std::cout <<
"reference cMo :\n" << pose_ref.
t() << std::endl << std::endl;
105 std::cout <<
"estimated cMo :\n" << pose_est.
t() << std::endl << std::endl;
108 for(
unsigned int i=0; i<6; i++) {
109 if (std::fabs(pose_ref[i]-pose_est[i]) > 0.001)
113 std::cout <<
"Matching is " << (test_fail ?
"badly" :
"well") <<
" performed" << std::endl;
118 std::cout <<
"Catch an exception: " << e << std::endl;
Implementation of an homogeneous matrix and operations on such kind of matrices.
error that can be emited by ViSP classes.
double get_y() const
Get the point y coordinate in the image plane.
Class that defines what is a point.
static void findMatch(std::vector< vpPoint > &p2D, std::vector< vpPoint > &p3D, const unsigned int &numberOfInlierToReachAConsensus, const double &threshold, unsigned int &ninliers, std::vector< vpPoint > &listInliers, vpHomogeneousMatrix &cMo, const int &maxNbTrials=10000)
double get_x() const
Get the point x coordinate in the image plane.
static double rad(double deg)
Implementation of a pose vector and operations on poses.