43 #include <visp3/core/vpCameraParameters.h> 44 #include <visp3/core/vpConfig.h> 45 #include <visp3/core/vpHomogeneousMatrix.h> 46 #include <visp3/core/vpImage.h> 47 #include <visp3/core/vpPoint.h> 48 #include <visp3/vision/vpPose.h> 49 #include <visp3/vision/vpPoseFeatures.h> 58 #ifndef DOXYGEN_SHOULD_SKIP_THIS 60 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) 61 class vp_createPointClass
66 vp_createPointClass() : value(0) {}
82 int test_pose(
bool use_robust)
85 std::cout <<
"** Test robust pose estimation from features\n" << std::endl;
87 std::cout <<
"** Test pose estimation from features\n" << std::endl;
94 std::cout <<
"Reference pose used to create the visual features : " << std::endl;
95 std::cout << pose_ref.
t() << std::endl;
99 std::vector<vpPoint> pts;
105 pts.push_back(
vpPoint(0.0, -val, val2));
106 pts.push_back(
vpPoint(0.0, val, val2));
107 pts.push_back(
vpPoint(-val, val, val2));
110 pts.push_back(
vpPoint(-val, -val / 2.0, val2));
111 pts.push_back(
vpPoint(val, val / 2.0, val2));
114 pts.push_back(
vpPoint(0.0, 0.0, -1.5));
131 pts[0].project(cMo_ref);
132 pts[1].project(cMo_ref);
133 pts[2].project(cMo_ref);
135 pts[3].project(cMo_ref);
136 pts[4].project(cMo_ref);
138 pts[5].project(cMo_ref);
161 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) 166 vp_createPointClass cpClass;
167 int (vp_createPointClass::*ptrClass)(
vpFeaturePoint &,
const vpPoint &) = &vp_createPointClass::vp_createPoint;
180 std::cout <<
"\nPose used as initialisation of the pose computation : " << std::endl;
181 std::cout << pose_est.
t() << std::endl;
189 std::cout <<
"\nEstimated pose from visual features : " << std::endl;
191 std::cout <<
"\nRobust estimated pose from visual features : " << std::endl;
194 std::cout << pose_est.
t() << std::endl;
196 std::cout <<
"\nResulting covariance (Diag): " << std::endl;
198 std::cout << covariance[0][0] <<
" " << covariance[1][1] <<
" " << covariance[2][2] <<
" " << covariance[3][3] <<
" " 199 << covariance[4][4] <<
" " << covariance[5][5] <<
" " << std::endl;
202 for (
unsigned int i = 0; i < 6; i++) {
203 if (std::fabs(pose_ref[i] - pose_est[i]) > 0.001)
207 std::cout <<
"\nPose is " << (test_fail ?
"badly" :
"well") <<
" estimated\n" << std::endl;
215 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...
vpPoseVector buildFrom(double tx, double ty, double tz, double tux, double tuy, double tuz)
Class that defines a 2D line visual feature which is composed by two parameters that are and ...
vpMatrix getCovarianceMatrix() const
static double rad(double deg)
void setCovarianceComputation(const bool &flag)
Implementation of a pose vector and operations on poses.
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 addSpecificFeature(RetType(*fct_ptr)(ArgsFunc...), Args &&... args)
void setWorldCoordinates(const vpColVector &oP)
const std::string & getStringMessage(void) const
Send a reference (constant) related the error message (can be empty).