Compute the pose from different features.
#include <visp/vpConfig.h>
#include <visp/vpHomogeneousMatrix.h>
#include <visp/vpPoint.h>
#include <visp/vpDisplay.h>
#include <visp/vpDisplayX.h>
#include <visp/vpImage.h>
#include <visp/vpCameraParameters.h>
#include <visp/vpPoseFeatures.h>
#include <visp/vpPose.h>
#include <iostream>
#include <vector>
#include <visp/vpPose.h>
#include <limits>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#ifdef VISP_HAVE_CPP11_COMPATIBILITY
class vp_createPointClass{
public:
int value;
vp_createPointClass() : value(0){}
value += 1;
return value;
}
};
}
}
#endif
#endif
int main()
{
try {
std::cout << "Reference pose used to create the visual features : " << std::endl;
std::cout << pose_ref.
t() << std::endl;
double val = 0.25;
double val2 = 0.0;
0.0,0.0,1.0,0.0);
1.0,0.0,0.0,-0.25);
-1.0,0.0,0.0,-0.25);
#ifdef VISP_HAVE_CPP11_COMPATIBILITY
vp_createPointClass cpClass;
int (vp_createPointClass::*ptrClass)(
vpFeaturePoint&,
const vpPoint&) = &vp_createPointClass::vp_createPoint;
#endif
std::cout << "\nPose used as initialisation of the pose computation : " << std::endl;
std::cout << pose_est.
t() << std::endl;
std::cout << "\nEstimated pose from visual features : " << std::endl;
std::cout << pose_est.
t() << std::endl;
std::cout << "\nResulting covariance (Diag): " << std::endl;
std::cout << covariance[0][0] << " " << covariance[1][1] << " "
<< covariance[2][2] << " " << covariance[3][3] << " "
<< covariance[4][4] << " " << covariance[5][5] << " " << std::endl;
int test_fail = 0;
for(unsigned int i=0; i<6; i++) {
if (std::fabs(pose_ref[i]-pose_est[i]) > 0.001)
test_fail = 1;
}
std::cout << "\nPose is " << (test_fail ? "badly" : "well") << " estimated" << std::endl;
return test_fail;
}
std::cout << "Catch an exception: " << e << std::endl;
return 1;
}
}