diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/libmv/libmv/simple_pipeline/modal_solver.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/intern/libmv/libmv/simple_pipeline/modal_solver.cc b/intern/libmv/libmv/simple_pipeline/modal_solver.cc index 6c1a983df35..f801518271c 100644 --- a/intern/libmv/libmv/simple_pipeline/modal_solver.cc +++ b/intern/libmv/libmv/simple_pipeline/modal_solver.cc @@ -175,8 +175,9 @@ void ModalSolver(const Tracks &tracks, // STEP 2: Refine rotation with Ceres. ceres::Problem problem; - ceres::LocalParameterization* quaternion_parameterization = - new ceres::QuaternionParameterization; + // NOTE: Parameterization is lazily initialized when it is really needed, + // and is re-used by all parameters block. + ceres::LocalParameterization* quaternion_parameterization = NULL; int num_residuals = 0; for (int i = 0; i < all_markers.size(); ++i) { @@ -195,6 +196,10 @@ void ModalSolver(const Tracks &tracks, &quaternion(0)); num_residuals++; + if (quaternion_parameterization == NULL) { + quaternion_parameterization = new ceres::QuaternionParameterization(); + } + problem.SetParameterization(&quaternion(0), quaternion_parameterization); } |