[Bf-blender-cvs] [6289d5b] blender-v2.74-release: Fix T44110: Plane track doesn't work when built with scons

Sergey Sharybin noreply at git.blender.org
Tue Mar 24 15:59:52 CET 2015


Commit: 6289d5b8d1c8ee6810a296cbe57e146ac5073b78
Author: Sergey Sharybin
Date:   Tue Mar 24 14:03:14 2015 +0500
Branches: blender-v2.74-release
https://developer.blender.org/rB6289d5b8d1c8ee6810a296cbe57e146ac5073b78

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.

===================================================================

M	extern/libmv/libmv/multiview/homography.cc

===================================================================

diff --git a/extern/libmv/libmv/multiview/homography.cc b/extern/libmv/libmv/multiview/homography.cc
index a7679c3..346acb3 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.




More information about the Bf-blender-cvs mailing list