Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: arg type for std::ceil and typo in glomap::EstimateRelativePoses #94

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

lnexenl
Copy link
Contributor

@lnexenl lnexenl commented Sep 6, 2024

I find this bug when reconstructing 4 images. std::ceil(num_image_pairs / kNumChunks) equals to zero at here for int64(4/10) equals zero, and the relative pose estimation actually failed here.

@ahojnnes
Copy link
Contributor

ahojnnes commented Sep 9, 2024

Thanks for catching this bug. LGTM.

@ahojnnes ahojnnes enabled auto-merge (squash) September 9, 2024 15:58
@@ -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. 🤣

@ahojnnes ahojnnes merged commit 410fc07 into colmap:main Sep 9, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants