24 #include "testing/testing.h"
27 using namespace libmv;
37 void CheckHomography2DTransform(
const Mat3&
H,
const Mat& x1,
const Mat&
x2) {
38 for (
int i = 0; i <
x2.cols(); ++i) {
39 Vec3 x2_expected =
x2.col(i);
40 Vec3 x2_observed =
H * x1.col(i);
41 x2_observed /= x2_observed(2);
42 EXPECT_MATRIX_NEAR(x2_expected, x2_observed, 1
e-8);
48 TEST(Homography2DTest, Rotation45AndTranslationXY) {
66 for (
int i = 0; i <
x2.cols(); ++i)
67 x2.col(i) = m * x1.col(i);
71 VLOG(1) <<
"Mat Homography2D ";
72 VLOG(1) << homography_mat;
75 EXPECT_MATRIX_NEAR(homography_mat, m, 1
e-8);
78 TEST(Homography2DTest, AffineGeneral4) {
94 for (
int i = 0; i <
x2.cols(); ++i) {
95 x2.col(i) = m * x1.col(i);
100 VLOG(1) <<
"Mat Homography2D";
101 VLOG(1) << homography_mat;
102 CheckHomography2DTransform(homography_mat, x1,
x2);
108 homography_mat.setIdentity();
111 VLOG(1) <<
"Mat Homography2D ";
112 VLOG(1) << homography_mat;
113 CheckHomography2DTransform(homography_mat, x1,
x2);
116 TEST(Homography2DTest, AffineGeneral5) {
131 for (
int i = 0; i <
x2.cols(); ++i)
132 x2.col(i) = m * x1.col(i);
137 VLOG(1) <<
"Mat Homography2D ";
138 VLOG(1) << homography_mat;
139 EXPECT_MATRIX_NEAR(homography_mat, m, 1
e-8);
145 homography_mat.setIdentity();
148 VLOG(1) <<
"Mat Homography2D ";
149 VLOG(1) << homography_mat;
150 EXPECT_MATRIX_NEAR(homography_mat, m, 1
e-8);
153 TEST(Homography2DTest, HomographyGeneral) {
168 for (
int i = 0; i <
x2.cols(); ++i)
169 x2.col(i) = m * x1.col(i);
174 VLOG(1) <<
"Mat Homography2D ";
175 VLOG(1) << homography_mat;
176 EXPECT_MATRIX_NEAR(homography_mat, m, 1
e-8);
179 TEST(Homography3DTest, RotationAndTranslationXYZ) {
223 for (
int i = 0; i <
x2.cols(); ++i) {
224 x2.col(i) =
M * x1.col(i);
230 VLOG(1) <<
"Mat Homography3D " << homography_mat;
231 VLOG(1) <<
"Mat GT " <<
M;
232 EXPECT_MATRIX_NEAR(homography_mat,
M, 1
e-8);
235 TEST(Homography3DTest, AffineGeneral) {
252 for (
int i = 0; i <
x2.cols(); ++i) {
253 x2.col(i) = m * x1.col(i);
258 VLOG(1) <<
"Mat Homography3D ";
259 VLOG(1) << homography_mat;
260 EXPECT_MATRIX_NEAR(homography_mat, m, 1
e-8);
263 TEST(Homography3DTest, HomographyGeneral) {
280 for (
int i = 0; i <
x2.cols(); ++i) {
281 x2.col(i) = m * x1.col(i);
286 VLOG(1) <<
"Mat Homography3D";
287 VLOG(1) << homography_mat;
288 EXPECT_MATRIX_NEAR(homography_mat, m, 1
e-8);
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble x2
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
TEST(PolynomialCameraIntrinsics2, ApplyOnFocalCenter)
void HomogeneousToEuclidean(const Mat &H, Mat *X)
bool Homography2DFromCorrespondencesLinear(const Mat &x1, const Mat &x2, Mat3 *H, double expected_precision)
bool Homography3DFromCorrespondencesLinear(const Mat &x1, const Mat &x2, Mat4 *H, double expected_precision)