diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-03-24 12:03:14 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-03-24 12:05:49 +0300 |
commit | 0f0e080a267c5c4fc7bd18566be28dd01ffb9499 (patch) | |
tree | 4db9a07781aaa825c193ee3e5a2a9ce1452304ee /extern | |
parent | cf365275c21e24f7653c3843b0d3f2a169101f2a (diff) |
Fix T44110: Plane track doesn't work when built with scons
For some reason recent change in avoiding non-aligned eigen vectors
was behaving differently for cmake and scons. Made it a bit different
now by storing scalars. This is more robust approach anyway, because
it's not really guaranteed Mat.col() gives a pointer inside data,
depending on column-major vs. row-major storage.
This is to be backported to 2.74 branch.
Diffstat (limited to 'extern')
-rw-r--r-- | extern/libmv/libmv/multiview/homography.cc | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/extern/libmv/libmv/multiview/homography.cc b/extern/libmv/libmv/multiview/homography.cc index a7679c33bbf..346acb3afd9 100644 --- a/extern/libmv/libmv/multiview/homography.cc +++ b/extern/libmv/libmv/multiview/homography.cc @@ -179,8 +179,12 @@ void GetNormalizedPoints(const Mat &original_points, class HomographySymmetricGeometricCostFunctor { public: HomographySymmetricGeometricCostFunctor(const Vec2 &x, - const Vec2 &y) - : x_(x), y_(y) { } + const Vec2 &y) { + xx_ = x(0); + xy_ = x(1); + yx_ = y(0); + yy_ = y(1); + } template<typename T> bool operator()(const T *homography_parameters, T *residuals) const { @@ -189,8 +193,8 @@ class HomographySymmetricGeometricCostFunctor { Mat3 H(homography_parameters); - Vec3 x(T(x_(0)), T(x_(1)), T(1.0)); - Vec3 y(T(y_(0)), T(y_(1)), T(1.0)); + Vec3 x(T(xx_), T(xy_), T(1.0)); + Vec3 y(T(yx_), T(yy_), T(1.0)); Vec3 H_x = H * x; Vec3 Hinv_y = H.inverse() * y; @@ -199,18 +203,19 @@ class HomographySymmetricGeometricCostFunctor { Hinv_y /= Hinv_y(2); // This is a forward error. - residuals[0] = H_x(0) - T(y_(0)); - residuals[1] = H_x(1) - T(y_(1)); + residuals[0] = H_x(0) - T(yx_); + residuals[1] = H_x(1) - T(yy_); // This is a backward error. - residuals[2] = Hinv_y(0) - T(x_(0)); - residuals[3] = Hinv_y(1) - T(x_(1)); + residuals[2] = Hinv_y(0) - T(xx_); + residuals[3] = Hinv_y(1) - T(xy_); return true; } - const Vec2 &x_; - const Vec2 &y_; + // TODO(sergey): Think of better naming. + double xx_, xy_; + double yx_, yy_; }; // Termination checking callback used for homography estimation. |