24
24
25
25
#include " ceres/ceres.h"
26
26
#include " ceres/rotation.h"
27
+ #include " ceres/version.h"
27
28
#include " libmv/base/vector.h"
28
29
#include " libmv/logging/logging.h"
29
30
#include " libmv/multiview/fundamental.h"
@@ -485,7 +486,11 @@ void EuclideanBundleCommonIntrinsics(
485
486
PackCamerasRotationAndTranslation (tracks, *reconstruction);
486
487
487
488
// Parameterization used to restrict camera motion for modal solvers.
489
+ #if CERES_VERSION_MAJOR >= 3 || (CERES_VERSION_MAJOR >= 2 && CERES_VERSION_MINOR >= 1)
490
+ ceres::SubsetManifold *constant_translation_manifold = NULL ;
491
+ #else
488
492
ceres::SubsetParameterization *constant_translation_parameterization = NULL ;
493
+ #endif
489
494
if (bundle_constraints & BUNDLE_NO_TRANSLATION) {
490
495
std::vector<int > constant_translation;
491
496
@@ -494,8 +499,13 @@ void EuclideanBundleCommonIntrinsics(
494
499
constant_translation.push_back (4 );
495
500
constant_translation.push_back (5 );
496
501
502
+ #if CERES_VERSION_MAJOR >= 3 || (CERES_VERSION_MAJOR >= 2 && CERES_VERSION_MINOR >= 1)
503
+ constant_translation_manifold =
504
+ new ceres::SubsetManifold (6 , constant_translation);
505
+ #else
497
506
constant_translation_parameterization =
498
507
new ceres::SubsetParameterization (6 , constant_translation);
508
+ #endif
499
509
}
500
510
501
511
// Add residual blocks to the problem.
@@ -538,8 +548,13 @@ void EuclideanBundleCommonIntrinsics(
538
548
}
539
549
540
550
if (bundle_constraints & BUNDLE_NO_TRANSLATION) {
551
+ #if CERES_VERSION_MAJOR >= 3 || (CERES_VERSION_MAJOR >= 2 && CERES_VERSION_MINOR >= 1)
552
+ problem.SetParameterization (current_camera_R_t,
553
+ constant_translation_manifold);
554
+ #else
541
555
problem.SetParameterization (current_camera_R_t,
542
556
constant_translation_parameterization);
557
+ #endif
543
558
}
544
559
545
560
zero_weight_tracks_flags[marker.track ] = false ;
@@ -586,10 +601,17 @@ void EuclideanBundleCommonIntrinsics(
586
601
// Always set K3 constant, it's not used at the moment.
587
602
constant_intrinsics.push_back (OFFSET_K3);
588
603
604
+ #if CERES_VERSION_MAJOR >= 3 || (CERES_VERSION_MAJOR >= 2 && CERES_VERSION_MINOR >= 1)
605
+ ceres::SubsetManifold *subset_manifold =
606
+ new ceres::SubsetManifold (OFFSET_MAX, constant_intrinsics);
607
+
608
+ problem.SetManifold (ceres_intrinsics, subset_manifold);
609
+ #else
589
610
ceres::SubsetParameterization *subset_parameterization =
590
611
new ceres::SubsetParameterization (OFFSET_MAX, constant_intrinsics);
591
612
592
613
problem.SetParameterization (ceres_intrinsics, subset_parameterization);
614
+ #endif
593
615
}
594
616
595
617
// Configure the solver.
0 commit comments