41 #include <visp3/core/vpHomogeneousMatrix.h>
42 #include <visp3/core/vpMath.h>
43 #include <visp3/core/vpPoint.h>
44 #include <visp3/vision/vpPose.h>
61 std::cout <<
"Pose computation with matched points" << std::endl;
62 std::vector<vpPoint> P;
64 P.push_back(
vpPoint(-L, -L, 0));
70 P.push_back(
vpPoint(0, -L2, 0));
73 P.push_back(
vpPoint(-L2, 0, 0));
76 for (
size_t i = 0; i < P.size(); i++) {
77 P[i].project(cMo_ref);
79 std::cout << std::endl;
84 P[3].set_y(P[3].get_y() + 2 * error);
85 P[6].set_x(P[6].get_x() + error);
88 for (
size_t i = 0; i < P.size(); i++)
91 unsigned int nbInlierToReachConsensus = (
unsigned int)(75.0 * (
double)(P.size()) / 100.0);
92 double threshold = 0.001;
103 std::cout <<
"Inliers: " << std::endl;
104 for (
unsigned int i = 0; i < inliers.size(); i++) {
106 std::cout << std::endl;
112 std::cout << std::endl;
113 std::cout <<
"reference cMo :\n" << pose_ref.
t() << std::endl << std::endl;
114 std::cout <<
"estimated cMo :\n" << pose_est.
t() << std::endl << std::endl;
117 for (
unsigned int i = 0; i < 6; i++) {
118 if (std::fabs(pose_ref[i] - pose_est[i]) > 0.001)
122 std::cout <<
"Pose is " << (test_fail ?
"badly" :
"well") <<
" estimated" << std::endl;
125 std::cout <<
"Catch an exception: " << e << std::endl;