Skip to content

Commit

Permalink
[sfm] Update API to fit ceres::manifold for constant parameter group #…
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoulon committed Feb 2, 2023
1 parent e1bbfe8 commit 6d64a35
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/openMVG/sfm/sfm_data_BA_ceres.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
namespace openMVG {
namespace sfm {

#define OPENMVG_CERES_HAS_MANIFOLD ((CERES_VERSION_MAJOR * 100 + CERES_VERSION_MINOR) >= 201)

using namespace openMVG::cameras;
using namespace openMVG::geometry;

Expand Down Expand Up @@ -279,9 +281,14 @@ bool Bundle_Adjustment_Ceres::Adjust
}
if (!vec_constant_extrinsic.empty())
{
ceres::SubsetParameterization *subset_parameterization =
#if OPENMVG_CERES_HAS_MANIFOLD
auto* subset_manifold = new ceres::SubsetManifold(6, vec_constant_extrinsic);
problem.SetManifold(parameter_block, subset_manifold);
#else
auto *subset_parameterization =
new ceres::SubsetParameterization(6, vec_constant_extrinsic);
problem.SetParameterization(parameter_block, subset_parameterization);
#endif
}
}
}
Expand Down Expand Up @@ -309,10 +316,17 @@ bool Bundle_Adjustment_Ceres::Adjust
intrinsic_it.second->subsetParameterization(options.intrinsics_opt);
if (!vec_constant_intrinsic.empty())
{
ceres::SubsetParameterization *subset_parameterization =
#if OPENMVG_CERES_HAS_MANIFOLD
auto* subset_manifold =
new ceres::SubsetManifold(
map_intrinsics.at(indexCam).size(), vec_constant_intrinsic);
problem.SetManifold(parameter_block, subset_manifold);
#else
auto *subset_parameterization =
new ceres::SubsetParameterization(
map_intrinsics.at(indexCam).size(), vec_constant_intrinsic);
problem.SetParameterization(parameter_block, subset_parameterization);
#endif
}
}
}
Expand Down

0 comments on commit 6d64a35

Please sign in to comment.