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
Conversation
distances->resize( | ||
query.rows(), | ||
std::min(kNumNearestNeighbors, static_cast<size_t>(database.rows()))); | ||
if (kNumNearestNeighbors > database.rows()) { |
There was a problem hiding this comment.
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.
src/feature/matching.cc
Outdated
return database_->ExistsKeypoints(image_id); | ||
} | ||
|
||
bool FeatureMatcherCache::ExiststDescriptors(const image_t image_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exists (not Existst)
src/feature/matching.cc
Outdated
@@ -277,6 +277,16 @@ std::vector<image_t> FeatureMatcherCache::GetImageIds() const { | |||
return image_ids; | |||
} | |||
|
|||
bool FeatureMatcherCache::ExiststKeypoints(const image_t image_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exists (not Existst)
src/feature/matching.cc
Outdated
continue; | ||
} | ||
|
||
if (!cache_->ExiststDescriptors(data.image_id1) || |
There was a problem hiding this comment.
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.
src/feature/matching.cc
Outdated
continue; | ||
} | ||
|
||
if (!cache_->ExiststDescriptors(data.image_id1) || |
There was a problem hiding this comment.
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.
Thanks, looks good to me. I left some minor comments that could be addressed before merging. |
…s with test function ExistsKeypoints.
Following your suggestion, I made a new commit. |
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. |
Thanks, this looks great. |
* 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.
Fix bug in sift feature matching, when features cannot be extracted from images lacking texture.
Fix bug in sift feature matching, when the number of feature points extracted from an image lacking texture is less than 2.