[Bf-blender-cvs] [1c0cdc3] master: Fixes for keyframe selection

Sergey Sharybin noreply at git.blender.org
Tue Jan 28 11:54:55 CET 2014


Commit: 1c0cdc385f68f3714fbf087acfb2696ee1c8383d
Author: Sergey Sharybin
Date:   Tue Jan 28 16:50:04 2014 +0600
https://developer.blender.org/rB1c0cdc385f68f3714fbf087acfb2696ee1c8383d

Fixes for keyframe selection

Using tracks with constant zero weight used to crash
keyframe selection since it was trying to use missing
parameter blocks for Jacobian evaluation,

Also fixed possible issues with wrong camera block being
marked as variable. This could technically happen when
having zero weighted tracks. Made it so all camera blocks
are marked as variable for now.

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

M	extern/libmv/ChangeLog
M	extern/libmv/libmv/simple_pipeline/bundle.cc

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

diff --git a/extern/libmv/ChangeLog b/extern/libmv/ChangeLog
index 225138b..476e01d 100644
--- a/extern/libmv/ChangeLog
+++ b/extern/libmv/ChangeLog
@@ -1,6 +1,27 @@
-commit b63b8d6989f460fda7d963a2c8b21e8ffa6f8066
+commit f71f7c59d4d13574ea4dc3a196cc22eef1c192df
 Author: Sergey Sharybin <sergey.vfx at gmail.com>
-Date:   Fri Jan 24 19:32:34 2014 +0600
+Date:   Tue Jan 28 16:39:14 2014 +0600
+
+    Fixed for keyframe selection
+    
+    Using tracks with constant zero weight used to crash
+    keyframe selection since it was trying to use missing
+    parameter blocks for Jacobian evaluation,
+    
+    Also fixed possible issues with wrong camera block being
+    marked as variable. This could technically happen when
+    having zero weighted tracks. Made it so all camera blocks
+    are marked as variable for now.
+
+commit 557d531b061aa69d114e89cbb325c5175389afec
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Tue Jan 28 16:10:33 2014 +0600
+
+    Style cleanup: wrong indentation of wrapped line
+
+commit ca15262cf07a873268173965ee1fb84f9729b744
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Tue Jan 28 15:21:36 2014 +0600
 
     Rework detector API and implement Harris detector
     
@@ -17,6 +38,8 @@ Date:   Fri Jan 24 19:32:34 2014 +0600
     
     Reviewers: keir
     
+    Reviewed By: keir
+    
     Differential Revision: https://developer.blender.org/D258
 
 commit 6458915f64fceba108c5279b7320ca8c76e8a742
@@ -651,38 +674,3 @@ Date:   Sat Apr 6 16:54:08 2013 +0600
     
     Further, not actually sure this is nice idea
     to use KLT in such synthetic case.
-
-commit 1e54624875284e9532f4880c067e80e474444b2e
-Author: Sergey Sharybin <sergey.vfx at gmail.com>
-Date:   Sat Apr 6 16:40:59 2013 +0600
-
-    Pyramid tracker unit test fix
-    
-    Issue was caused by trackers modifying guessed
-    point location even in case of failure. So made
-    id so both level 0 and level 3 of pyramid are
-    starting from the same initial guessed location.
-    
-    Modifying locations in case tracker returns false
-    is not actually a bug - someone could still want
-    to use that location. False in this case  means
-    more like "returned location is not so much
-    accurate".
-
-commit b46c48e0e1862828df6dca711148c11b1f60777c
-Author: Sergey Sharybin <sergey.vfx at gmail.com>
-Date:   Sat Apr 6 00:38:40 2013 +0600
-
-    Intersect unit test fix
-    
-    EuclideanIntersect is not aware of camera calibration
-    matrix yet and always assumes it to be an identity.
-    
-    So using non-identity matrix to construct sample case
-    leads to wrong projection results.
-    
-    For now made it so test case uses identity matrix for
-    calibration.
-    
-    Also fixed variable shadowing which lead to wrong
-    markers positions (were either zero or undefined).
diff --git a/extern/libmv/libmv/simple_pipeline/bundle.cc b/extern/libmv/libmv/simple_pipeline/bundle.cc
index e788725..9835248 100644
--- a/extern/libmv/libmv/simple_pipeline/bundle.cc
+++ b/extern/libmv/libmv/simple_pipeline/bundle.cc
@@ -262,10 +262,24 @@ void EuclideanBundlerPerformEvaluation(const Tracks &tracks,
     int num_cameras = all_cameras_R_t->size();
     int num_points = 0;
 
+    vector<EuclideanPoint*> minimized_points;
     for (int i = 0; i <= max_track; i++) {
-      const EuclideanPoint *point = reconstruction->PointForTrack(i);
+      EuclideanPoint *point = reconstruction->PointForTrack(i);
       if (point) {
-        num_points++;
+        // We need to know whether the track is constant zero weight,
+        // and it so it wouldn't have parameter block in the problem.
+        //
+        // Getting all markers for track is not so bac currently since
+        // this code is only used by keyframe selection when there are
+        // not so much tracks and only 2 frames anyway.
+        vector<Marker> markera_of_track = tracks.MarkersForTrack(i);
+        for (int j = 0; j < markera_of_track.size(); j++) {
+          if (markera_of_track.at(j).weight != 0.0) {
+            minimized_points.push_back(point);
+            num_points++;
+            break;
+          }
+        }
       }
     }
 
@@ -275,35 +289,28 @@ void EuclideanBundlerPerformEvaluation(const Tracks &tracks,
     evaluation->num_cameras = num_cameras;
     evaluation->num_points = num_points;
 
-    if (evaluation->evaluate_jacobian) {
-      // Evaluate jacobian matrix.
+    if (evaluation->evaluate_jacobian) {      // Evaluate jacobian matrix.
       ceres::CRSMatrix evaluated_jacobian;
       ceres::Problem::EvaluateOptions eval_options;
 
       // Cameras goes first in the ordering.
       int max_image = tracks.MaxImage();
-      bool is_first_camera = true;
       for (int i = 0; i <= max_image; i++) {
         const EuclideanCamera *camera = reconstruction->CameraForImage(i);
         if (camera) {
           double *current_camera_R_t = &(*all_cameras_R_t)[i](0);
 
           // All cameras are variable now.
-          if (is_first_camera) {
-            problem->SetParameterBlockVariable(current_camera_R_t);
-            is_first_camera = false;
-          }
+          problem->SetParameterBlockVariable(current_camera_R_t);
 
           eval_options.parameter_blocks.push_back(current_camera_R_t);
         }
       }
 
       // Points goes at the end of ordering,
-      for (int i = 0; i <= max_track; i++) {
-        EuclideanPoint *point = reconstruction->PointForTrack(i);
-        if (point) {
-          eval_options.parameter_blocks.push_back(&point->X(0));
-        }
+      for (int i = 0; i < minimized_points.size(); i++) {
+        EuclideanPoint *point = minimized_points.at(i);
+        eval_options.parameter_blocks.push_back(&point->X(0));
       }
 
       problem->Evaluate(eval_options,
@@ -405,7 +412,7 @@ void EuclideanBundleCommonIntrinsics(const Tracks &tracks,
 
       if (bundle_constraints & BUNDLE_NO_TRANSLATION) {
         problem.SetParameterization(current_camera_R_t,
-                                  constant_translation_parameterization);
+                                    constant_translation_parameterization);
       }
     }




More information about the Bf-blender-cvs mailing list