Camera tracking: small improvements to tripod solver"
authorSergey Sharybin <sergey.vfx@gmail.com>
Sat, 28 Apr 2012 14:40:37 +0000 (14:40 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sat, 28 Apr 2012 14:40:37 +0000 (14:40 +0000)
- Disable camera refirement due to it's not only refines camera intrinsics
  but also adjusts camera position which isn't necessary here
- Detect rigid transformation between initial frame and current instead
  of detecting it between two neighbour frames.
  This prevents accumulation of error and seems to be working better
  in footages i've tested.

extern/libmv/libmv-capi.cpp
extern/libmv/libmv-capi.h
extern/libmv/libmv/simple_pipeline/modal_solver.cc
release/scripts/startup/bl_ui/space_clip.py
source/blender/blenkernel/intern/tracking.c

index 3f697d487b6234238baad7e240df25027dead697..6c20d76eeac900626c1d25437e8e874edf880dc5 100644 (file)
@@ -460,7 +460,7 @@ libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyfra
        return (libmv_Reconstruction *)libmv_reconstruction;
 }
 
-struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks *tracks, int refine_intrinsics, double focal_length,
+struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks *tracks, double focal_length,
                        double principal_x, double principal_y, double k1, double k2, double k3,
                        reconstruct_progress_update_cb progress_update_callback, void *callback_customdata)
 {
@@ -488,11 +488,6 @@ struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks *tracks, int r
 
        libmv::ModalSolver(normalized_tracks, reconstruction, &update_callback);
 
-       if (refine_intrinsics) {
-               libmv_solveRefineIntrinsics((libmv::Tracks *)tracks, intrinsics, reconstruction,
-                       refine_intrinsics, progress_update_callback, callback_customdata);
-       }
-
        progress_update_callback(callback_customdata, 1.0, "Finishing solution");
        libmv_reconstruction->tracks = *(libmv::Tracks *)tracks;
        libmv_reconstruction->error = libmv::EuclideanReprojectionError(*(libmv::Tracks *)tracks, *reconstruction, *intrinsics);
index f72a72d494b313673195d6679d07da96ca3322ac..bccc47068322741badca2c1d68a1c60f1827217f 100644 (file)
@@ -68,7 +68,7 @@ int libmv_refineParametersAreValid(int parameters);
 struct libmv_Reconstruction *libmv_solveReconstruction(struct libmv_Tracks *tracks, int keyframe1, int keyframe2,
                        int refine_intrinsics, double focal_length, double principal_x, double principal_y, double k1, double k2, double k3,
                        reconstruct_progress_update_cb progress_update_callback, void *callback_customdata);
-struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks *tracks, int refine_intrinsics, double focal_length,
+struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks *tracks, double focal_length,
                        double principal_x, double principal_y, double k1, double k2, double k3,
                        reconstruct_progress_update_cb progress_update_callback, void *callback_customdata);
 int libmv_reporojectionPointForTrack(struct libmv_Reconstruction *libmv_reconstruction, int track, double pos[3]);
index ede0071dc645e28dc26e222a2604c5b526278bcd..bb49b30dbcef737bf71650c8718424f2cf803a2d 100644 (file)
@@ -91,19 +91,15 @@ void ModalSolver(Tracks &tracks,
 
           ProjectMarkerOnSphere(marker, X);
 
-          points.push_back(R * point->X);
+          points.push_back(point->X);
           reference_points.push_back(X);
         }
       }
     }
 
     if (points.size()) {
-      Mat3 dR = Mat3::Identity();
-
-      // Find rigid delta transformation from previous image to current image
-      RigidRegistration(reference_points, points, dR);
-
-      R *= dR;
+      // Find rigid delta transformation to current image
+      RigidRegistration(reference_points, points, R);
     }
 
     reconstruction->InsertCamera(image, R, Vec3::Zero());
index fb84fa29cbc1b99368ce58d3681573542e156859..e4f608e266019c2637eecf52d1bd222c74738ff3 100644 (file)
@@ -256,7 +256,7 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
         col.prop(settings, "keyframe_b")
 
         col = layout.column(align=True)
-        col.active = tracking_object.is_camera
+        col.active = tracking_object.is_camera and not settings.use_tripod_solver
         col.label(text="Refine:")
         col.prop(settings, "refine_intrinsics", text="")
 
index 9e3bc2648a5a53361c2d5d97e2cd24a16cd75c1e..e511cd362de8d52aea5b3ee8461f318446fb5366 100644 (file)
@@ -1902,7 +1902,6 @@ void BKE_tracking_solve_reconstruction(MovieReconstructContext *context, short *
 
        if (context->motion_flag & TRACKING_MOTION_MODAL) {
                context->reconstruction = libmv_solveModal(context->tracks,
-                       context->refine_flags,
                        context->focal_length,
                        context->principal_point[0], context->principal_point[1],
                        context->k1, context->k2, context->k3,