#include <visp3/core/vpConfig.h>
#include <visp3/vision/vpHomography.h>
#include <visp3/core/vpMeterPixelConversion.h>
int main()
{
#ifdef ENABLE_VISP_NAMESPACE
#endif
double L = 0.1;
std::vector<vpPoint> oP;
oP.push_back(
vpPoint(2 * L, -L, 0));
oP.push_back(
vpPoint(L, 3 * L, 0));
oP.push_back(
vpPoint(-L, 4 * L, 0));
std::vector<vpPoint> aP(4), bP(4);
std::vector<double> xa(4), ya(4), xb(4), yb(4);
for (unsigned int i = 0; i < 4; i++) {
oP[i].project(aMo);
xa[i] = oP[i].get_x();
ya[i] = oP[i].get_y();
oP[i].project(bMo);
xb[i] = oP[i].get_x();
yb[i] = oP[i].get_y();
}
std::cout << "Estimated homography using DLT:\n" << aHb / aHb[2][2] << std::endl;
std::cout << "Estimated homography using HLM:\n" << aHb / aHb[2][2] << std::endl;
std::cout << "\nEstimated displacement:" << std::endl;
std::cout <<
" atb: " << atb.
t() << std::endl;
std::cout << " athetaub: ";
for (unsigned int i = 0; i < 3; i++)
std::cout << std::endl;
std::cout <<
" n: " << n.
t() << std::endl;
std::cout << "Ground truth: Point 3 in pixels in frame b: " << iPb << std::endl;
std::cout << "Ground truth: Point 3 in pixels in frame a: " << iPa << std::endl;
std::cout <<
"Estimation from homography: Point 3 in pixels in frame a: " <<
vpHomography::project(cam, aHb, iPb)
<< std::endl;
}
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of an homography and operations on homographies.
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)
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)
static vpImagePoint project(const vpCameraParameters &cam, const vpHomography &bHa, const vpImagePoint &iPa)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
static double rad(double deg)
static double deg(double rad)
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Implementation of a rotation matrix and operations on such kind of matrices.
Implementation of a rotation vector as axis-angle minimal representation.
vpThetaUVector & buildFrom(const vpHomogeneousMatrix &M)
Class that consider the case of a translation vector.