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 bugs of sift feature matching #985

Merged
merged 4 commits into from Sep 21, 2020
Merged

Fix bugs of sift feature matching #985

merged 4 commits into from Sep 21, 2020

Conversation

whuaegeanse
Copy link
Contributor

  1. Fix bug in sift feature matching, when features cannot be extracted from images lacking texture.

  2. Fix bug in sift feature matching, when the number of feature points extracted from an image lacking texture is less than 2.

distances->resize(
query.rows(),
std::min(kNumNearestNeighbors, static_cast<size_t>(database.rows())));
if (kNumNearestNeighbors > database.rows()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not really relevant for the COLMAP codebase, but technically we would still populate the indices/distances output and just skip the FLANN code block below.

return database_->ExistsKeypoints(image_id);
}

bool FeatureMatcherCache::ExiststDescriptors(const image_t image_id) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Exists (not Existst)

@@ -277,6 +277,16 @@ std::vector<image_t> FeatureMatcherCache::GetImageIds() const {
return image_ids;
}

bool FeatureMatcherCache::ExiststKeypoints(const image_t image_id) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Exists (not Existst)

continue;
}

if (!cache_->ExiststDescriptors(data.image_id1) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be combined with the ExistsKeypoints() tests above.

continue;
}

if (!cache_->ExiststDescriptors(data.image_id1) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be combined with the ExistsKeypoints() tests above.

@ahojnnes
Copy link
Contributor

Thanks, looks good to me. I left some minor comments that could be addressed before merging.

@whuaegeanse
Copy link
Contributor Author

Thanks, looks good to me. I left some minor comments that could be addressed before merging.

Following your suggestion, I made a new commit.

@ahojnnes
Copy link
Contributor

Thanks, one more comment: it would be good to use an LRU cache similar to keypoints_/descriptors_cache_ for the new Exists methods to avoid disk access to the database.

@whuaegeanse
Copy link
Contributor Author

Thanks, one more comment: it would be good to use an LRU cache similar to keypoints_/descriptors_cache_ for the new Exists methods to avoid disk access to the database.

Good idea. I have learnt a lot from you. Thank you for providing such a great open source SfM engine.

@ahojnnes
Copy link
Contributor

Thanks, this looks great.

@ahojnnes ahojnnes merged commit 54523e6 into colmap:dev Sep 21, 2020
lucasthahn pushed a commit to TNE-ai/colmap that referenced this pull request Aug 17, 2022
* Fix bugs of sift features matching.

* Remove the return value.

* Change names of function. And combine test function ExiststDescriptors with test function ExistsKeypoints.

* Enhance the feature of testing keypoints and descriptors by using LRUCache.
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.

None yet

2 participants