Blender V4.3
triangulation_test.cc
Go to the documentation of this file.
1// Copyright (c) 2007, 2008 libmv authors.
2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to
5// deal in the Software without restriction, including without limitation the
6// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7// sell copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions:
9//
10// The above copyright notice and this permission notice shall be included in
11// all copies or substantial portions of the Software.
12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19// IN THE SOFTWARE.
20
21#include <iostream>
22
28#include "testing/testing.h"
29
30namespace {
31using namespace libmv;
32
33TEST(Triangulation, TriangulateDLT) {
35
36 for (int i = 0; i < d.X.cols(); ++i) {
37 Vec2 x1, x2;
38 MatrixColumn(d.x1, i, &x1);
39 MatrixColumn(d.x2, i, &x2);
40 Vec3 X_estimated, X_gt;
41 MatrixColumn(d.X, i, &X_gt);
42 TriangulateDLT(d.P1, x1, d.P2, x2, &X_estimated);
43 EXPECT_NEAR(0, DistanceLInfinity(X_estimated, X_gt), 1e-8);
44 }
45}
46
47} // namespace
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
double DistanceLInfinity(const TVec &x, const TVec &y)
Definition numeric.h:216
TwoViewDataSet TwoRealisticCameras(bool same_K)
Eigen::Vector2d Vec2
Definition numeric.h:105
void TriangulateDLT(const Mat34 &P1, const Vec2 &x1, const Mat34 &P2, const Vec2 &x2, Vec4 *X_homogeneous)
TEST(PolynomialCameraIntrinsics2, ApplyOnFocalCenter)
void MatrixColumn(const Mat &A, int i, Vec2 *v)
Definition numeric.cc:127
Eigen::Vector3d Vec3
Definition numeric.h:106