40 #include <visp3/vision/vpPose.h>
41 #include <visp3/core/vpPoint.h>
42 #include <visp3/core/vpMath.h>
43 #include <visp3/core/vpTranslationVector.h>
44 #include <visp3/core/vpRxyzVector.h>
45 #include <visp3/core/vpRotationMatrix.h>
46 #include <visp3/core/vpHomogeneousMatrix.h>
47 #include <visp3/core/vpDebug.h>
64 const std::string &legend);
71 std::cout << std::endl << legend <<
"\n "
72 <<
"tx = " << cpo[0] <<
"\n "
73 <<
"ty = " << cpo[1] <<
"\n "
74 <<
"tz = " << cpo[2] <<
"\n "
75 <<
"tux = vpMath::rad(" <<
vpMath::deg(cpo[3]) <<
")\n "
76 <<
"tuy = vpMath::rad(" <<
vpMath::deg(cpo[4]) <<
")\n "
77 <<
"tuz = vpMath::rad(" <<
vpMath::deg(cpo[5]) <<
")\n"
83 const std::string &legend)
91 for(
unsigned int i=0; i<6; i++) {
92 if (std::fabs(pose_ref[i]-pose_est[i]) > 0.001)
96 std::cout <<
"Based on 3D parameters " << legend <<
" is " << (fail ?
"badly" :
"well") <<
" estimated" << std::endl;
100 if (pose.
listP.size() < 4) {
102 std::cout <<
"Not enough point" << std::endl;
105 r = sqrt(r)/pose.
listP.size();
107 fail = (r > 0.1) ? 1 : 0;
108 std::cout <<
"Based on 2D residual (" << r <<
") " << legend <<
" is " << (fail ?
"badly" :
"well") <<
" estimated" << std::endl;
125 int test_fail = 0, fail = 0;
130 for(
int i=0 ; i < 5 ; i++) {
137 print_pose(cMo_ref, std::string(
"Reference pose"));
139 std::cout <<
"-------------------------------------------------"<<std::endl ;
142 print_pose(cMo, std::string(
"Pose estimated by Lagrange"));
143 fail = compare_pose(pose, cMo_ref, cMo,
"pose by Lagrange");
146 std::cout <<
"--------------------------------------------------"<<std::endl ;
149 print_pose(cMo, std::string(
"Pose estimated by Dementhon"));
150 fail = compare_pose(pose, cMo_ref, cMo,
"pose by Dementhon");
153 std::cout <<
"--------------------------------------------------"<<std::endl ;
158 print_pose(cMo, std::string(
"Pose estimated by Ransac"));
159 fail = compare_pose(pose, cMo_ref, cMo,
"pose by Ransac");
162 std::cout <<
"--------------------------------------------------"<<std::endl ;
165 print_pose(cMo, std::string(
"Pose estimated by Lagrange than Lowe"));
166 fail = compare_pose(pose, cMo_ref, cMo,
"pose by Lagrange than Lowe");
169 std::cout <<
"--------------------------------------------------"<<std::endl ;
172 print_pose(cMo, std::string(
"Pose estimated by Dementhon than Lowe"));
173 fail = compare_pose(pose, cMo_ref, cMo,
"pose by Dementhon than Lowe");
178 std::cout <<
"--------------------------------------------------"<<std::endl ;
181 print_pose(cMo, std::string(
"Pose estimated by VVS"));
182 fail = compare_pose(pose, cMo_ref, cMo,
"pose by VVS");
185 std::cout <<
"-------------------------------------------------"<<std::endl ;
188 print_pose(cMo, std::string(
"Pose estimated by Dementhon than by VVS"));
189 fail = compare_pose(pose, cMo_ref, cMo,
"pose by Dementhon than by VVS");
192 std::cout <<
"-------------------------------------------------"<<std::endl ;
195 print_pose(cMo, std::string(
"Pose estimated by Lagrange than by VVS"));
196 fail = compare_pose(pose, cMo_ref, cMo,
"pose by Lagrange than by VVS");
199 std::cout <<
"\nGlobal pose estimation test " << (test_fail ?
"fail" :
"is ok") << std::endl;
204 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)
std::list< vpPoint > listP
Array of point (use here class vpPoint)
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)
static double rad(double deg)
void setRansacNbInliersToReachConsensus(const unsigned int &nbC)
static double deg(double rad)
void setWorldCoordinates(const double oX, const double oY, const double oZ)
Implementation of a pose vector and operations on poses.
void addPoint(const vpPoint &P)
double computeResidual(const vpHomogeneousMatrix &cMo) const
Compute and return the residual expressed in meter for the pose matrix 'cMo'.