[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56722] branches/soc-2011-tomato: Merging r56717 through r56719 from trunk into soc-2011-tomato

Sergey Sharybin sergey.vfx at gmail.com
Sun May 12 19:17:05 CEST 2013


Revision: 56722
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56722
Author:   nazgul
Date:     2013-05-12 17:17:05 +0000 (Sun, 12 May 2013)
Log Message:
-----------
Merging r56717 through r56719 from trunk into soc-2011-tomato

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56717
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56719

Modified Paths:
--------------
    branches/soc-2011-tomato/extern/libmv/ChangeLog
    branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/bundle.cc
    branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/bundle.h
    branches/soc-2011-tomato/extern/libmv/libmv-capi.cpp
    branches/soc-2011-tomato/extern/libmv/third_party/glog/src/windows/port.h
    branches/soc-2011-tomato/source/blender/blenfont/intern/blf_font.c

Property Changed:
----------------
    branches/soc-2011-tomato/
    branches/soc-2011-tomato/source/blender/editors/interface/interface.c
    branches/soc-2011-tomato/source/blender/editors/space_outliner/


Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-56716
   + /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-56719

Modified: branches/soc-2011-tomato/extern/libmv/ChangeLog
===================================================================
--- branches/soc-2011-tomato/extern/libmv/ChangeLog	2013-05-12 17:16:43 UTC (rev 56721)
+++ branches/soc-2011-tomato/extern/libmv/ChangeLog	2013-05-12 17:17:05 UTC (rev 56722)
@@ -1,3 +1,44 @@
+commit f003b9e3031db4592c2d91b1ea2538c73b7e767d
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Sun May 12 22:34:54 2013 +0600
+
+    Cleanup in simple pipeline's bundler
+    
+    - Better match Google's code style conventions.
+    - Move evaluation part into own function, makes
+      bundling itself easier to follow.
+    - Made evaluation an optional parameter.
+    - Removed note about unsupported camera intrinsics
+      refining flags. Technically, all combinations
+      are possible.
+
+commit f0e68f69e5c5f0fd82334246d382e59f1eb20164
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Sun May 12 22:19:31 2013 +0600
+
+    Remove check for zero focal length in BA cost functor
+    
+    This check is actually redundant, because empty intrinsics
+    will have focal length of 1.0, which means original comment
+    about BundleIntrinsics was not truth.
+    
+    It is possible that external user will send focal length of
+    zero to be refined, but blender prevents this from happening.
+
+commit 7ed5e4da65d2c0df63a08b1e1f4b4de1855f1bf0
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Sat May 11 20:33:54 2013 +0600
+
+    Fix compilation error with msvc2012
+    
+    Using change from glog's upstream for this.
+
+commit 7e162266f96abc25d80e2352cd77f21ed93593b7
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Sat May 11 19:50:57 2013 +0600
+
+    Style cleanup, mainly pointed by Sameer in Ceres's codereview
+
 commit 42da053c6410b4f3fb13798c7e9c5f4a861b6825
 Author: Sergey Sharybin <sergey.vfx at gmail.com>
 Date:   Fri May 10 18:30:40 2013 +0600
@@ -600,69 +641,3 @@
     Use threaded cost function, jacobian and linear solver
     computation, so bundling is as fast as it could be with
     current parameter block structure.
-
-commit 931fe37a10212b91b525d4f6eb753990a338b471
-Author: Sergey Sharybin <sergey.vfx at gmail.com>
-Date:   Fri Mar 1 17:29:21 2013 +0600
-
-    Fixed comment for euclidean bundling,
-    which is now supports raidal bundling independently
-    from other intrinsics.
-
-commit 217d8e6edc3de1a853fb84275d2d2dd898e7529c
-Author: Sergey Sharybin <sergey.vfx at gmail.com>
-Date:   Tue Feb 26 18:19:01 2013 +0600
-
-    Allow K1,K2 refirement combination
-    
-    It is now possible to refine only radial distortion
-    with new Ceres based bundler and this new combination
-    is already used in Blender.
-
-commit d8850addc944d400f7a9c358396c437d9e4acc70
-Author: Sergey Sharybin <sergey.vfx at gmail.com>
-Date:   Tue Feb 26 18:17:09 2013 +0600
-
-    Switch euclidean intersection code to use Ceres
-    
-    Would not expect any significant changes in solver
-    behavior, but it could be more accurate in some cases.
-    
-    Switching projective intersection to ceres is marked
-    as a TODO for now.
-
-commit 6990b7946ec96b3cb2dcfc8a1beaaba9538b0802
-Author: Keir Mierle <mierle at gmail.com>
-Date:   Mon Feb 25 20:00:48 2013 +0000
-
-    Switch motion tracker bundle adjustment to Ceres.
-    
-    Patch originally written by me, then finished by Sergey. Big
-    thanks to Sergey for troopering through and fixing the many issues
-    with my original (not compilable) patch.
-    
-    The Ceres implementation uses 2 parameter blocks for each camera
-    (1 for rotation and 1 for translation), 1 parameter block for
-    common intrinsics (focal length etc) and 1 parameter block for
-    each track (e.g. bundle or 3D point).
-    
-    We turn on some fancy optimizer options to get better performance,
-    in particular:
-    
-      options.preconditioner_type = ceres::SCHUR_JACOBI;
-      options.linear_solver_type = ceres::ITERATIVE_SCHUR;
-      options.use_inner_iterations = true;
-      options.use_nonmonotonic_steps = true;
-      options.max_num_iterations = 100;
-    
-    Special thanks to Sameer Agarwal of Ceres fame for splitting out
-    the SCHUR_JACOBI preconditioner so that it didn't depend on
-    CHOLMOD.  Previously we could not use that preconditioner in
-    Blender because CHOLMOD is too large of a dependency for Blender.
-    
-    BundleIntrinsicsLogMessage:
-    - Moved bunch of if(foo) LG << "bar" into this function, to make
-      EuclideanBundleCommonIntrinsics a little bit easier to follow.
-    
-    EuclideanBundle:
-    - Fix RMSE logging.

Modified: branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/bundle.cc
===================================================================
--- branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/bundle.cc	2013-05-12 17:16:43 UTC (rev 56721)
+++ branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/bundle.cc	2013-05-12 17:17:05 UTC (rev 56722)
@@ -24,7 +24,6 @@
 
 #include "ceres/ceres.h"
 #include "ceres/rotation.h"
-#include "libmv/base/scoped_ptr.h"
 #include "libmv/base/vector.h"
 #include "libmv/logging/logging.h"
 #include "libmv/multiview/fundamental.h"
@@ -55,15 +54,20 @@
 
 namespace {
 
+// Cost functor which computes reprojection error of 3D point X
+// on camera defined by angle-axis rotation and it's translation
+// (which are in the same block due to optimization reasons).
+//
+// This functor uses a radial distortion model.
 struct OpenCVReprojectionError {
-  OpenCVReprojectionError(double observed_x, double observed_y)
+  OpenCVReprojectionError(const double observed_x, const double observed_y)
       : observed_x(observed_x), observed_y(observed_y) {}
 
   template <typename T>
   bool operator()(const T* const intrinsics,
                   const T* const R_t,  // Rotation denoted by angle axis
                                        // followed with translation
-                  const T* const X,  // Point coordinates 3x1.
+                  const T* const X,    // Point coordinates 3x1.
                   T* residuals) const {
     // Unpack the intrinsics.
     const T& focal_length      = intrinsics[OFFSET_FOCAL_LENGTH];
@@ -84,8 +88,9 @@
     x[2] += R_t[5];
 
     // Prevent points from going behind the camera.
-    if (x[2] < T(0))
+    if (x[2] < T(0)) {
       return false;
+    }
 
     // Compute normalized coordinates: x /= x[2].
     T xn = x[0] / x[2];
@@ -93,92 +98,72 @@
 
     T predicted_x, predicted_y;
 
-    // EuclideanBundle uses empty intrinsics, which breaks undistortion code;
-    // so use an implied focal length of 1.0 if the focal length is exactly
-    // zero.
-    // TODO(keir): Figure out a better way to do this.
-    if (focal_length != T(0)) {
-      // Apply distortion to the normalized points to get (xd, yd).
-      // TODO(keir): Do early bailouts for zero distortion; these are expensive
-      // jet operations.
+    // Apply distortion to the normalized points to get (xd, yd).
+    // TODO(keir): Do early bailouts for zero distortion; these are expensive
+    // jet operations.
+    ApplyRadialDistortionCameraIntrinsics(focal_length,
+                                          focal_length,
+                                          principal_point_x,
+                                          principal_point_y,
+                                          k1, k2, k3,
+                                          p1, p2,
+                                          xn, yn,
+                                          &predicted_x,
+                                          &predicted_y);
 
-      ApplyRadialDistortionCameraIntrinsics(focal_length,
-                                            focal_length,
-                                            principal_point_x,
-                                            principal_point_y,
-                                            k1, k2, k3,
-                                            p1, p2,
-                                            xn, yn,
-                                            &predicted_x,
-                                            &predicted_y);
-    } else {
-      predicted_x = xn;
-      predicted_y = yn;
-    }
-
     // The error is the difference between the predicted and observed position.
     residuals[0] = predicted_x - T(observed_x);
     residuals[1] = predicted_y - T(observed_y);
-
     return true;
   }
 
-  double observed_x;
-  double observed_y;
+  const double observed_x;
+  const double observed_y;
 };
 
-void BundleIntrinsicsLogMessage(int bundle_intrinsics) {
+// Print a message to the log which camera intrinsics are gonna to be optimixed.
+void BundleIntrinsicsLogMessage(const int bundle_intrinsics) {
   if (bundle_intrinsics == BUNDLE_NO_INTRINSICS) {
-    LG << "Bundling only camera positions.";
-  } else if (bundle_intrinsics == BUNDLE_FOCAL_LENGTH) {
-    LG << "Bundling f.";
-  } else if (bundle_intrinsics == (BUNDLE_FOCAL_LENGTH |
-                                   BUNDLE_PRINCIPAL_POINT)) {
-    LG << "Bundling f, px, py.";
-  } else if (bundle_intrinsics == (BUNDLE_FOCAL_LENGTH |
-                                   BUNDLE_PRINCIPAL_POINT |
-                                   BUNDLE_RADIAL)) {
-    LG << "Bundling f, px, py, k1, k2.";
-  } else if (bundle_intrinsics == (BUNDLE_FOCAL_LENGTH |
-                                   BUNDLE_PRINCIPAL_POINT |
-                                   BUNDLE_RADIAL |
-                                   BUNDLE_TANGENTIAL)) {
-    LG << "Bundling f, px, py, k1, k2, p1, p2.";

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list