Skip to content
Merged
Changes from all commits
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
7 changes: 4 additions & 3 deletions glomap/estimators/relpose_estimation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ void EstimateRelativePoses(ViewGraph& view_graph,

const int64_t num_image_pairs = valid_pair_ids.size();
const int64_t kNumChunks = 10;
const int64_t inverval = std::ceil(num_image_pairs / kNumChunks);
const int64_t interval =
std::ceil(static_cast<double>(num_image_pairs) / kNumChunks);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
std::ceil(static_cast<double>(num_image_pairs) / kNumChunks);
std::min(num_image_pairs / kNumChunks, 1);

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this would be a safer alternative that handles the full range of int64 numbers while double may not hold the full range of int64 numbers. This is unrealistic though, because this for loop would probably run for a very very long time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks so much! I really did not take this problem into account. But as you say, I think there won't be anyone processing so many pictures. 🤣

LOG(INFO) << "Estimating relative pose for " << num_image_pairs << " pairs";
for (int64_t chunk_id = 0; chunk_id < kNumChunks; chunk_id++) {
std::cout << "\r Estimating relative pose: " << chunk_id * kNumChunks << "%"
<< std::flush;
const int64_t start = chunk_id * inverval;
const int64_t start = chunk_id * interval;
const int64_t end =
std::min<int64_t>((chunk_id + 1) * inverval, num_image_pairs);
std::min<int64_t>((chunk_id + 1) * interval, num_image_pairs);

#pragma omp parallel for schedule(dynamic) private( \
points2D_1, points2D_2, inliers)
Expand Down