[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46038] trunk/blender: Camera tracking: support of tripod motion solving

Sergey Sharybin sergey.vfx at gmail.com
Sat Apr 28 16:54:45 CEST 2012


Revision: 46038
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46038
Author:   nazgul
Date:     2012-04-28 14:54:45 +0000 (Sat, 28 Apr 2012)
Log Message:
-----------
Camera tracking: support of tripod motion solving

Expose option into interface to use modal solver which currently
supports only tripod motion.

This solver requires two tracks at least to reconstruct motion.
Using more tracks aren't improving solution in general, just adds
instability into solution and slows down things a lot.

Refirement of camera intrinsics was disabled due to it's not only
refines camera intrinsics but also adjusts camera position which
isn't necessary here

To use this solver just activate "Tripod Motion" checkbox in
solver panel.

Merged from tomato: svn merge ^/branches/soc-2011-tomato -r45622:45624 -r46036:46037

P.S. Quite experimental yet, requires more checking and probably
tweaks to prevent camera jumps when tracks apperars/disappears
from the screen.

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

Modified Paths:
--------------
    trunk/blender/extern/libmv/CMakeLists.txt
    trunk/blender/extern/libmv/ChangeLog
    trunk/blender/extern/libmv/files.txt
    trunk/blender/extern/libmv/libmv-capi.cpp
    trunk/blender/extern/libmv/libmv-capi.h
    trunk/blender/release/scripts/startup/bl_ui/space_clip.py
    trunk/blender/source/blender/blenkernel/intern/tracking.c
    trunk/blender/source/blender/makesdna/DNA_tracking_types.h
    trunk/blender/source/blender/makesrna/intern/rna_tracking.c

Added Paths:
-----------
    trunk/blender/extern/libmv/libmv/simple_pipeline/modal_solver.cc
    trunk/blender/extern/libmv/libmv/simple_pipeline/modal_solver.h

Property Changed:
----------------
    trunk/blender/
    trunk/blender/source/blender/editors/space_outliner/


Property changes on: trunk/blender
___________________________________________________________________
Modified: svn:mergeinfo
   - /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/soc-2011-tomato:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151-44152,44229-44230,45625
   + /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/soc-2011-tomato:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151-44152,44229-44230,45623-45625,46037

Modified: trunk/blender/extern/libmv/CMakeLists.txt
===================================================================
--- trunk/blender/extern/libmv/CMakeLists.txt	2012-04-28 14:40:37 UTC (rev 46037)
+++ trunk/blender/extern/libmv/CMakeLists.txt	2012-04-28 14:54:45 UTC (rev 46038)
@@ -69,6 +69,7 @@
 	libmv/simple_pipeline/detect.cc
 	libmv/simple_pipeline/initialize_reconstruction.cc
 	libmv/simple_pipeline/intersect.cc
+	libmv/simple_pipeline/modal_solver.cc
 	libmv/simple_pipeline/pipeline.cc
 	libmv/simple_pipeline/reconstruction.cc
 	libmv/simple_pipeline/resect.cc
@@ -126,6 +127,7 @@
 	libmv/simple_pipeline/detect.h
 	libmv/simple_pipeline/initialize_reconstruction.h
 	libmv/simple_pipeline/intersect.h
+	libmv/simple_pipeline/modal_solver.h
 	libmv/simple_pipeline/pipeline.h
 	libmv/simple_pipeline/reconstruction.h
 	libmv/simple_pipeline/resect.h

Modified: trunk/blender/extern/libmv/ChangeLog
===================================================================
--- trunk/blender/extern/libmv/ChangeLog	2012-04-28 14:40:37 UTC (rev 46037)
+++ trunk/blender/extern/libmv/ChangeLog	2012-04-28 14:54:45 UTC (rev 46038)
@@ -1,3 +1,16 @@
+commit a44312a7beb2963b8e3bf8015c516d2eff40cc3d
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Thu Apr 12 13:56:02 2012 +0600
+
+    Added solver for modal camera motion, currently supports only tripod solving
+    
+    This solver is intended to deal with such camera motions as tripod and panning,
+    where it's impossible to reconstruct exact position of markers in 3d view.
+    
+    It projects markers onto sphere and uses rigid registration of rotation to
+    find rotation angles which makes bundles from previous and current frame be
+    as closest as it's possible.
+
 commit fa3842e472e3b9c789e47bf6d8f592aa40a84f16
 Author: Sergey Sharybin <sergey.vfx at gmail.com>
 Date:   Thu Apr 12 12:32:48 2012 +0600
@@ -520,9 +533,3 @@
 Date:   Fri Aug 19 16:04:37 2011 +0200
 
     MSVC compatibility: heap allocate pattern, explicit float cast.
-
-commit 702658d2f8616964a6eeb3743fd85e97ac7ff09d
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Fri Aug 19 14:59:24 2011 +0200
-
-    Expose regularization parameters (areaPenalty and conditionPenalty) in API.

Modified: trunk/blender/extern/libmv/files.txt
===================================================================
--- trunk/blender/extern/libmv/files.txt	2012-04-28 14:40:37 UTC (rev 46037)
+++ trunk/blender/extern/libmv/files.txt	2012-04-28 14:54:45 UTC (rev 46038)
@@ -42,6 +42,8 @@
 libmv/simple_pipeline/initialize_reconstruction.h
 libmv/simple_pipeline/intersect.cc
 libmv/simple_pipeline/intersect.h
+libmv/simple_pipeline/modal_solver.cc
+libmv/simple_pipeline/modal_solver.h
 libmv/simple_pipeline/pipeline.cc
 libmv/simple_pipeline/pipeline.h
 libmv/simple_pipeline/reconstruction.cc

Copied: trunk/blender/extern/libmv/libmv/simple_pipeline/modal_solver.cc (from rev 45624, branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/modal_solver.cc)
===================================================================
--- trunk/blender/extern/libmv/libmv/simple_pipeline/modal_solver.cc	                        (rev 0)
+++ trunk/blender/extern/libmv/libmv/simple_pipeline/modal_solver.cc	2012-04-28 14:54:45 UTC (rev 46038)
@@ -0,0 +1,126 @@
+// Copyright (c) 2012 libmv authors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+
+#include <cstdio>
+
+#include "libmv/logging/logging.h"
+#include "libmv/simple_pipeline/modal_solver.h"
+#include "libmv/simple_pipeline/rigid_registration.h"
+
+#ifdef _MSC_VER
+#  define snprintf _snprintf
+#endif
+
+namespace libmv {
+
+static void ProjectMarkerOnSphere(Marker &marker, Vec3 &X) {
+  X(0) = marker.x;
+  X(1) = marker.y;
+  X(2) = 1.0;
+
+  X *= 5.0 / X.norm();
+}
+
+static void ModalSolverLogProress(ProgressUpdateCallback *update_callback,
+    double progress)
+{
+  if (update_callback) {
+    char message[256];
+
+    snprintf(message, sizeof(message), "Solving progress %d%%", (int)(progress * 100));
+
+    update_callback->invoke(progress, message);
+  }
+}
+
+void ModalSolver(Tracks &tracks,
+                 EuclideanReconstruction *reconstruction,
+                 ProgressUpdateCallback *update_callback) {
+  int max_image = tracks.MaxImage();
+  int max_track = tracks.MaxTrack();
+
+  LG << "Max image: " << max_image;
+  LG << "Max track: " << max_track;
+
+  Mat3 R = Mat3::Identity();
+
+  for (int image = 0; image <= max_image; ++image) {
+    vector<Marker> all_markers = tracks.MarkersInImage(image);
+
+    ModalSolverLogProress(update_callback, (float) image / max_image);
+
+    // Skip empty frames without doing anything
+    if (all_markers.size() == 0) {
+      LG << "Skipping frame: " << image;
+      continue;
+    }
+
+    vector<Vec3> points, reference_points;
+
+    // Cnstruct pairs of markers from current and previous image,
+    // to reproject them and find rigid transformation between
+    // previous and current image
+    for (int track = 0; track <= max_track; ++track) {
+      EuclideanPoint *point = reconstruction->PointForTrack(track);
+
+      if (point) {
+        Marker marker = tracks.MarkerInImageForTrack(image, track);
+
+        if (marker.image == image) {
+          Vec3 X;
+
+          LG << "Use track " << track << " for rigid registration between image " <<
+            image - 1 << " and " << image;
+
+          ProjectMarkerOnSphere(marker, X);
+
+          points.push_back(point->X);
+          reference_points.push_back(X);
+        }
+      }
+    }
+
+    if (points.size()) {
+      // Find rigid delta transformation to current image
+      RigidRegistration(reference_points, points, R);
+    }
+
+    reconstruction->InsertCamera(image, R, Vec3::Zero());
+
+    // Review if there's new tracks for which position might be reconstructed
+    for (int track = 0; track <= max_track; ++track) {
+      if (!reconstruction->PointForTrack(track)) {
+        Marker marker = tracks.MarkerInImageForTrack(image, track);
+
+        if (marker.image == image) {
+          // New track appeared on this image, project it's position onto sphere
+
+          LG << "Projecting track " << track << " at image " << image;
+
+          Vec3 X;
+          ProjectMarkerOnSphere(marker, X);
+          reconstruction->InsertPoint(track, R.inverse() * X);
+        }
+      }
+    }
+  }
+}
+
+}  // namespace libmv

Copied: trunk/blender/extern/libmv/libmv/simple_pipeline/modal_solver.h (from rev 45624, branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/modal_solver.h)
===================================================================
--- trunk/blender/extern/libmv/libmv/simple_pipeline/modal_solver.h	                        (rev 0)
+++ trunk/blender/extern/libmv/libmv/simple_pipeline/modal_solver.h	2012-04-28 14:54:45 UTC (rev 46038)
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 libmv authors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+
+#ifndef LIBMV_SIMPLE_PIPELINE_MODAL_SOLVER_H_
+#define LIBMV_SIMPLE_PIPELINE_MODAL_SOLVER_H_
+
+#include "libmv/simple_pipeline/tracks.h"
+#include "libmv/simple_pipeline/reconstruction.h"
+#include "libmv/simple_pipeline/callbacks.h"
+
+namespace libmv {
+
+/*!
+    This solver solves such camera motion as tripod rotation, reconstructing
+    only camera motion itself. Bundles are not reconstructing properly, they're
+    just getting projected onto sphere.
+

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list