2 #include <visp/vpHomography.h>
3 #include <visp/vpMeterPixelConversion.h>
8 std::vector<vpPoint> oP(4);
9 oP[0].setWorldCoordinates( -L,-L, 0);
10 oP[1].setWorldCoordinates(2*L,-L, 0);
11 oP[2].setWorldCoordinates( L, 3*L, 0);
12 oP[3].setWorldCoordinates( -L, 4*L, 0);
18 std::vector<vpPoint> aP(4), bP(4);
19 std::vector<double> xa(4), ya(4), xb(4), yb(4);
20 for(
unsigned int i=0 ; i < 4; i++)
23 xa[i] = oP[i].get_x();
24 ya[i] = oP[i].get_y();
26 xb[i] = oP[i].get_x();
27 yb[i] = oP[i].get_y();
32 std::cout <<
"Estimated homography using DLT:\n" << aHb/aHb[2][2] << std::endl;
35 std::cout <<
"Estimated homography using HLM:\n" << aHb/aHb[2][2] << std::endl;
42 std::cout <<
"\nEstimated displacement:" << std::endl;
43 std::cout <<
" atb: " << atb.
t() << std::endl;
46 std::cout <<
" athetaub: ";
47 for(
unsigned int i=0; i<3; i++)
49 std::cout << std::endl;
50 std::cout <<
" n: " << n.
t() << std::endl;
57 std::cout <<
"Ground truth: Point 3 in pixels in frame b: " << iPb << std::endl;
58 std::cout <<
"Ground truth: Point 3 in pixels in frame a: " << iPa << std::endl;
61 std::cout <<
"Estimation from homography: Point 3 in pixels in frame a: "
static vpImagePoint project(const vpCameraParameters &cam, const vpHomography &bHa, const vpImagePoint &iPa)
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Point coordinates conversion from normalized coordinates in meter to pixel coordinates ...
vpThetaUVector buildFrom(const vpHomogeneousMatrix &M)
void computeDisplacement(vpRotationMatrix &aRb, vpTranslationVector &atb, vpColVector &n)
static void HLM(const std::vector< double > &xb, const std::vector< double > &yb, const std::vector< double > &xa, const std::vector< double > &ya, bool isplanar, vpHomography &aHb)
The vpRotationMatrix considers the particular case of a rotation matrix.
This class aims to compute the homography wrt.two images.
vpRowVector t() const
transpose of Vector
Generic class defining intrinsic camera parameters.
static double rad(double deg)
static void DLT(const std::vector< double > &xb, const std::vector< double > &yb, const std::vector< double > &xa, const std::vector< double > &ya, vpHomography &aHb, bool normalization=true)
static double deg(double rad)
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Class that consider the case of a translation vector.
Class that consider the case of the parameterization for the rotation.