42 #include <visp3/core/vpConfig.h>
43 #include <visp3/core/vpHomogeneousMatrix.h>
44 #include <visp3/core/vpPoint.h>
45 #include <visp3/core/vpImage.h>
46 #include <visp3/core/vpCameraParameters.h>
47 #include <visp3/vision/vpPoseFeatures.h>
48 #include <visp3/vision/vpPose.h>
57 #ifndef DOXYGEN_SHOULD_SKIP_THIS
59 #ifdef VISP_HAVE_CPP11_COMPATIBILITY
60 class vp_createPointClass{
64 vp_createPointClass() : value(0){}
84 int test_pose(
bool use_robust)
87 std::cout <<
"** Test robust pose estimation from features\n" << std::endl;
89 std::cout <<
"** Test pose estimation from features\n" << std::endl;
96 std::cout <<
"Reference pose used to create the visual features : " << std::endl;
97 std::cout << pose_ref.
t() << std::endl;
101 std::vector<vpPoint> pts;
107 pts.push_back(
vpPoint(0.0,-val,val2) );
108 pts.push_back(
vpPoint(0.0,val,val2) );
109 pts.push_back(
vpPoint(-val,val,val2) );
112 pts.push_back(
vpPoint(-val,-val/2.0,val2) );
113 pts.push_back(
vpPoint(val,val/2.0,val2) );
116 pts.push_back(
vpPoint(0.0,0.0,-1.5) );
136 pts[0].project(cMo_ref);
137 pts[1].project(cMo_ref);
138 pts[2].project(cMo_ref);
140 pts[3].project(cMo_ref);
141 pts[4].project(cMo_ref);
143 pts[5].project(cMo_ref);
166 #ifdef VISP_HAVE_CPP11_COMPATIBILITY
171 vp_createPointClass cpClass;
172 int (vp_createPointClass::*ptrClass)(
vpFeaturePoint&,
const vpPoint&) = &vp_createPointClass::vp_createPoint;
185 std::cout <<
"\nPose used as initialisation of the pose computation : " << std::endl;
186 std::cout << pose_est.
t() << std::endl;
194 std::cout <<
"\nEstimated pose from visual features : " << std::endl;
196 std::cout <<
"\nRobust estimated pose from visual features : " << std::endl;
199 std::cout << pose_est.
t() << std::endl;
201 std::cout <<
"\nResulting covariance (Diag): " << std::endl;
203 std::cout << covariance[0][0] <<
" " << covariance[1][1] <<
" "
204 << covariance[2][2] <<
" " << covariance[3][3] <<
" "
205 << covariance[4][4] <<
" " << covariance[5][5] <<
" " << std::endl;
208 for(
unsigned int i=0; i<6; i++) {
209 if (std::fabs(pose_ref[i]-pose_est[i]) > 0.001)
213 std::cout <<
"\nPose is " << (test_fail ?
"badly" :
"well") <<
" estimated\n" << std::endl;
221 if (test_pose(
false))
Implementation of a matrix and operations on matrices.
void setVerbose(const bool &mode)
void setVVSIterMax(const unsigned int &val)
Implementation of an homogeneous matrix and operations on such kind of matrices.
void setWorldCoordinates(const double &A1, const double &B1, const double &C1, const double &D1, const double &A2, const double &B2, const double &C2, const double &D2)
error that can be emited by ViSP classes.
Class that defines a 2D point visual feature which is composed by two parameters that are the cartes...
void addFeatureVanishingPoint(const vpPoint &)
void setLambda(const double &val)
void addFeaturePoint3D(const vpPoint &)
void addFeaturePoint(const vpPoint &)
Class that defines what is a point.
void addFeatureEllipse(const vpCircle &)
void computePose(vpHomogeneousMatrix &cMo, const vpPoseFeaturesMethodType &type=VIRTUAL_VS)
Class that defines a line in the object frame, the camera frame and the image plane. All the parameters must be set in meter.
Class that defines a 2D segment visual features. This class allow to consider two sets of visual feat...
Class that defines a 2D line visual feature which is composed by two parameters that are and ...
static double rad(double deg)
void setCovarianceComputation(const bool &flag)
vpMatrix getCovarianceMatrix() const
Implementation of a pose vector and operations on poses.
void addSpecificFeature(RetType(*fct_ptr)(ArgsFunc...), Args &&...args)
vpPoseVector buildFrom(const double tx, const double ty, const double tz, const double tux, const double tuy, const double tuz)
const std::string & getStringMessage(void) const
Send a reference (constant) related the error message (can be empty).
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d)
Tools for pose computation from any feature.This class allows to estimate a pose by virtual visual se...
Class that defines what is a circle.
void setWorldCoordinates(const vpColVector &oP)