48 #include <visp3/core/vpMath.h> 49 #include <visp3/core/vpRotationMatrix.h> 50 #include <visp3/vision/vpHomography.h> 51 #include <visp3/core/vpDebug.h> 52 #include <visp3/core/vpThetaUVector.h> 56 bool test(
const std::string &s,
const vpHomography &H,
const std::vector<double> &bench)
58 static unsigned int cpt = 0;
59 std::cout <<
"** Test " << ++cpt << std::endl;
60 std::cout << s <<
"(" << H.
getRows() <<
"," << H.
getCols() <<
") = \n[" << H <<
"]" << std::endl;
61 if(bench.size() != H.
size()) {
62 std::cout <<
"Test fails: bad size wrt bench" << std::endl;
65 for (
unsigned int i=0; i<H.
size(); i++) {
66 if (std::fabs(H.
data[i]-bench[i]) > std::fabs(H.
data[i])*std::numeric_limits<double>::epsilon()) {
67 std::cout <<
"Test fails: bad content" << std::endl;
81 std::vector<double> bench(9, 0);
82 bench[0] = bench[4] = bench[8] = 1.;
83 if (test(
"H", H, bench) ==
false)
85 if (test(
"H", H/H[2][2], bench) ==
false)
91 std::cout <<
"Initialization " <<std::endl ;
94 std::cout <<
"From vpThetaUVector to vpRotationMatrix " << std::endl ;
101 std::cout <<
"M" <<std::endl <<M << std::endl ;
106 std::cout <<
"H" <<std::endl <<H << std::endl ;
113 std::cout <<
"R" <<std::endl << R ;
114 std::cout <<
"T" <<std::endl << T.
t() << std::endl;
115 std::cout <<
"n" <<std::endl << n.
t() << std::endl;
117 std::cout <<
"------------------------------------------------------" << std::endl ;
122 std::cout <<
"Initialization " << std::endl ;
125 std::cout <<
"From vpThetaUVector to vpRotationMatrix " << std::endl ;
136 std::cout <<
"M" << std::endl << M << std::endl ;
141 std::cout <<
"H" << std::endl << H << std::endl ;
148 std::cout <<
"R" <<std::endl << R ;
149 std::cout <<
"T" <<std::endl << T.
t() << std::endl;
150 std::cout <<
"n" <<std::endl << n.
t() << std::endl;
153 std::cout <<
"------------------------------------------------------" << std::endl ;
167 std::cout <<
"M" << std::endl << M << std::endl ;
172 std::cout <<
"H" << std::endl << H << std::endl ;
178 std::cout <<
"R" <<std::endl << R ;
179 std::cout <<
"T" <<std::endl << T.
t() << std::endl;
180 std::cout <<
"n" <<std::endl << n.
t() << std::endl;
182 vpPlane p1(n[0],n[1],n[2],1.0) ;
184 std::cout <<
"H" << std::endl << H << std::endl ;
186 std::cout <<
"All tests succeed" << std::endl;
190 std::cout <<
"Catch an exception: " << e << std::endl;
void buildFrom(const vpRotationMatrix &aRb, const vpTranslationVector &atb, const vpPlane &bP)
Construction from Translation and rotation and a plane.
Implementation of an homogeneous matrix and operations on such kind of matrices.
error that can be emited by ViSP classes.
Type * data
Address of the first element of the data array.
unsigned int size() const
Return the number of elements of the 2D array.
unsigned int getCols() const
Return the number of columns of the 2D array.
void computeDisplacement(vpRotationMatrix &aRb, vpTranslationVector &atb, vpColVector &n)
Implementation of a rotation matrix and operations on such kind of matrices.
void insert(const vpRotationMatrix &R)
Implementation of an homography and operations on homographies.
unsigned int getRows() const
Return the number of rows of the 2D array.
static double rad(double deg)
Implementation of column vector and the associated operations.
This class defines the container for a plane geometrical structure.
Class that consider the case of a translation vector.
Implementation of a rotation vector as axis-angle minimal representation.