Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions glomap/controllers/global_mapper.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "global_mapper.h"

#include "glomap/io/colmap_converter.h"
#include "glomap/processors/image_pair_inliers.h"
#include "glomap/processors/image_undistorter.h"
#include "glomap/processors/reconstruction_pruning.h"
Expand Down Expand Up @@ -167,6 +168,13 @@ bool GlobalMapper::Solve(const colmap::Database& database,
images,
tracks,
options_.inlier_thresholds.max_angle_error);

// Normalize the structure
colmap::Reconstruction reconstruction;
ConvertGlomapToColmap(cameras, images, tracks, reconstruction, -1, true);
reconstruction.Normalize();
ConvertColmapToGlomap(reconstruction, cameras, images, tracks);

run_timer.PrintSeconds();
}

Expand Down Expand Up @@ -209,6 +217,12 @@ bool GlobalMapper::Solve(const colmap::Database& database,
if (ite != options_.num_iteration_bundle_adjustment - 1)
run_timer.PrintSeconds();

// Normalize the structure
colmap::Reconstruction reconstruction;
ConvertGlomapToColmap(cameras, images, tracks, reconstruction, -1, true);
reconstruction.Normalize();
ConvertColmapToGlomap(reconstruction, cameras, images, tracks);
Copy link
Contributor

@ahojnnes ahojnnes Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code block is identical for all 3 instances. Would it make sense to extract it into a helper function: NormalizeReconstruction(...) ? It's a little unfortunate that we need to go through the whole forward/backward conversion process each time instead of directly normalizing the glomap data structure. Did you measure the performance impact of this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not have any quantitative numbers on the performance, but only qualitative ones: without rescaling, the number of points is 10282, and with normalization, the number of points is 12100 for one test set where the reconstruction scale is extreme after estimation. In this case, does it make sense to follow the COLMAP function and implement a new GLOMAP version? Then we don't need to do the model conversion at all


// 6.3. Filter tracks based on the estimation
// For the filtering, in each round, the criteria for outlier is
// tightened. If only few tracks are changed, no need to start bundle
Expand Down Expand Up @@ -292,6 +306,12 @@ bool GlobalMapper::Solve(const colmap::Database& database,
run_timer.PrintSeconds();
}

// Normalize the structure
colmap::Reconstruction reconstruction;
ConvertGlomapToColmap(cameras, images, tracks, reconstruction, -1, true);
reconstruction.Normalize();
ConvertColmapToGlomap(reconstruction, cameras, images, tracks);

// Filter tracks based on the estimation
UndistortImages(cameras, images, true);
LOG(INFO) << "Filtering tracks by reprojection ...";
Expand Down
Loading