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 <<
"Pose computation with matched points" << 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 ) );
71 P.push_back(
vpPoint(0,-L2, 0 ) );
72 P.push_back(
vpPoint(L2,0, 0 ) );
73 P.push_back(
vpPoint(0,L2, 0 ) );
74 P.push_back(
vpPoint(-L2,0, 0 ) );
77 for(
size_t i=0 ; i < P.size(); i++)
79 P[i].project(cMo_ref) ;
81 std::cout << std::endl;
86 P[3].set_y(P[3].get_y() + 2*error);
87 P[6].set_x(P[6].get_x() + error);
90 for(
size_t i=0 ; i < P.size() ; i++)
93 unsigned int nbInlierToReachConsensus = (
unsigned int)(75.0 * (
double)(P.size()) / 100.0);
94 double threshold = 0.001;
105 std::cout <<
"Inliers: " << std::endl;
106 for (
unsigned int i = 0; i < inliers.size() ; i++)
109 std::cout << std::endl;
115 std::cout << std::endl;
116 std::cout <<
"reference cMo :\n" << pose_ref.
t() << std::endl << std::endl;
117 std::cout <<
"estimated cMo :\n" << pose_est.
t() << std::endl << std::endl;
120 for(
unsigned int i=0; i<6; i++) {
121 if (std::fabs(pose_ref[i]-pose_est[i]) > 0.001)
125 std::cout <<
"Pose is " << (test_fail ?
"badly" :
"well") <<
" estimated" << std::endl;
129 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.
void setRansacThreshold(const double &t)
Class that defines what is a point.
Class used for pose computation from N points (pose from point only). Some of the algorithms implemen...
bool computePose(vpPoseMethodType method, vpHomogeneousMatrix &cMo, bool(*func)(vpHomogeneousMatrix *)=NULL)
void setRansacNbInliersToReachConsensus(const unsigned int &nbC)
Implementation of a pose vector and operations on poses.
void addPoint(const vpPoint &P)
std::vector< vpPoint > getRansacInliers() const