@@ -20,18 +20,17 @@ Eigen::Vector3d RandVector3d(std::mt19937& random_generator,
2020
2121} // namespace
2222
23- GlobalPositioner::GlobalPositioner (
24- const GlobalPositionerOptions& options)
23+ GlobalPositioner::GlobalPositioner (const GlobalPositionerOptions& options)
2524 : options_(options) {
2625 random_generator_.seed (options_.seed );
2726}
2827
2928bool GlobalPositioner::Solve (const ViewGraph& view_graph,
30- std::unordered_map<rig_t , Rig>& rigs,
31- std::unordered_map<camera_t , Camera>& cameras,
32- std::unordered_map<frame_t , Frame>& frames,
33- std::unordered_map<image_t , Image>& images,
34- std::unordered_map<track_t , Track>& tracks) {
29+ std::unordered_map<rig_t , Rig>& rigs,
30+ std::unordered_map<camera_t , Camera>& cameras,
31+ std::unordered_map<frame_t , Frame>& frames,
32+ std::unordered_map<image_t , Image>& images,
33+ std::unordered_map<track_t , Track>& tracks) {
3534 if (rigs.size () > 1 ) {
3635 LOG (ERROR) << " Number of camera rigs = " << rigs.size ();
3736 }
@@ -60,7 +59,8 @@ bool GlobalPositioner::Solve(const ViewGraph& view_graph,
6059 InitializeRandomPositions (view_graph, frames, images, tracks);
6160
6261 // Add the camera to camera constraints to the problem.
63- // TODO: support the relative constraints with trivial frames to a non trivial frame
62+ // TODO: support the relative constraints with trivial frames to a non trivial
63+ // frame
6464 if (options_.constraint_type != GlobalPositionerOptions::ONLY_POINTS) {
6565 AddCameraToCameraConstraints (view_graph, images);
6666 }
@@ -114,7 +114,6 @@ void GlobalPositioner::SetupProblem(
114114 return sum + track.second .observations .size ();
115115 }));
116116
117-
118117 // Initialize the rig scales to be 1.0.
119118 for (const auto & [rig_id, rig] : rigs) {
120119 rig_scales_.emplace (rig_id, 1.0 );
@@ -167,11 +166,12 @@ void GlobalPositioner::InitializeRandomPositions(
167166
168167void GlobalPositioner::AddCameraToCameraConstraints (
169168 const ViewGraph& view_graph, std::unordered_map<image_t , Image>& images) {
170- // For cam to cam constraint, only support the trivial frames now
171- for (const auto & [image_id, image] : images) {
169+ // For cam to cam constraint, only support the trivial frames now
170+ for (const auto & [image_id, image] : images) {
172171 if (!image.is_registered ) continue ;
173172 if (!image.HasTrivialFrame ()) {
174- LOG (ERROR) << " Now, only trivial frames are supported for the camera to camera constraints" ;
173+ LOG (ERROR) << " Now, only trivial frames are supported for the camera to "
174+ " camera constraints" ;
175175 }
176176 }
177177
@@ -207,7 +207,6 @@ void GlobalPositioner::AddCameraToCameraConstraints(
207207 VLOG (2 ) << problem_->NumResidualBlocks ()
208208 << " camera to camera constraints were added to the position "
209209 " estimation problem." ;
210-
211210}
212211
213212void GlobalPositioner::AddPointToCameraConstraints (
@@ -358,8 +357,8 @@ void GlobalPositioner::AddTrackToProblem(
358357 // the rig is not needed, as it would natrually be consistent with the
359358 // global one
360359 ceres::CostFunction* cost_function =
361- RigUnknownBATAPairwiseDirectionError::Create (translation,
362- image.frame_ptr ->RigFromWorld ().rotation );
360+ RigUnknownBATAPairwiseDirectionError::Create (
361+ translation, image.frame_ptr ->RigFromWorld ().rotation );
363362
364363 problem_->AddResidualBlock (
365364 cost_function,
@@ -577,7 +576,8 @@ void GlobalPositioner::ConvertResults(
577576 std::map<sensor_t , std::optional<Rigid3d>>& sensors = rig.Sensors ();
578577 for (auto & [sensor_id, cam_from_rig] : sensors) {
579578 if (cam_from_rig.has_value ()) {
580- if (problem_->HasParameterBlock (rig.SensorFromRig (sensor_id).translation .data ())) {
579+ if (problem_->HasParameterBlock (
580+ rig.SensorFromRig (sensor_id).translation .data ())) {
581581 cam_from_rig->translation =
582582 -(cam_from_rig->rotation * cam_from_rig->translation );
583583 } else {
@@ -588,7 +588,6 @@ void GlobalPositioner::ConvertResults(
588588 }
589589 }
590590 }
591-
592591}
593592
594593} // namespace glomap
0 commit comments