50 #include <visp3/core/vpDebug.h> 51 #include <visp3/core/vpMath.h> 52 #include <visp3/core/vpRotationMatrix.h> 53 #include <visp3/core/vpThetaUVector.h> 54 #include <visp3/vision/vpHomography.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;
77 #if (defined(VISP_HAVE_LAPACK) || defined(VISP_HAVE_EIGEN3) || defined(VISP_HAVE_OPENCV)) 82 std::vector<double> bench(9, 0);
83 bench[0] = bench[4] = bench[8] = 1.;
85 if (test(
"H", H, bench) ==
false)
87 if (test(
"H", H / H[2][2], bench) ==
false)
93 std::cout <<
"Initialization " << std::endl;
96 std::cout <<
"From vpThetaUVector to vpRotationMatrix " << std::endl;
103 std::cout <<
"M" << std::endl << M << std::endl;
108 std::cout <<
"H" << std::endl << H << std::endl;
115 std::cout <<
"R" << std::endl << R;
116 std::cout <<
"T" << std::endl << T.
t() << std::endl;
117 std::cout <<
"n" << std::endl << n.
t() << std::endl;
119 std::cout <<
"------------------------------------------------------" << std::endl;
124 std::cout <<
"Initialization " << std::endl;
127 std::cout <<
"From vpThetaUVector to vpRotationMatrix " << std::endl;
138 std::cout <<
"M" << std::endl << M << std::endl;
143 std::cout <<
"H" << std::endl << H << std::endl;
150 std::cout <<
"R" << std::endl << R;
151 std::cout <<
"T" << std::endl << T.
t() << std::endl;
152 std::cout <<
"n" << std::endl << n.
t() << std::endl;
155 std::cout <<
"------------------------------------------------------" << std::endl;
169 std::cout <<
"M" << std::endl << M << std::endl;
174 std::cout <<
"H" << std::endl << H << std::endl;
180 std::cout <<
"R" << std::endl << R;
181 std::cout <<
"T" << std::endl << T.
t() << std::endl;
182 std::cout <<
"n" << std::endl << n.
t() << std::endl;
184 vpPlane p1(n[0], n[1], n[2], 1.0);
186 std::cout <<
"H" << std::endl << H << std::endl;
188 std::cout <<
"All tests succeed" << std::endl;
191 std::cout <<
"Catch an exception: " << e << std::endl;
195 std::cout <<
"Cannot run this example: install Lapack, Eigen3 or OpenCV" << 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
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
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.