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 Matcher Confidence Handling #19955

Conversation

danielenricocahall
Copy link
Contributor

@danielenricocahall danielenricocahall commented Apr 21, 2021

Per the issue #11084, we don't throw high confidence matches in AffineBestOf2NearestMatcher, but we do in BestOf2NearestMatcher. In this PR, I am commenting out the line for consistency across the two feature matchers (it's currently commented out in the affine as well). An alternative idea is making this threshold configurable.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@@ -768,7 +768,7 @@ void BestOf2NearestMatcher::match(const ImageFeatures &features1, const ImageFea

// Set zero confidence to remove matches between too close images, as they don't provide
// additional information anyway. The threshold was set experimentally.
matches_info.confidence = matches_info.confidence > 3. ? 0. : matches_info.confidence;
// matches_info.confidence = matches_info.confidence > 3. ? 0. : matches_info.confidence;
Copy link
Member

Choose a reason for hiding this comment

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

What is about the comment above of this code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alalek could you re-review/approve at earliest convenience? Thank you!

Copy link
Member

Choose a reason for hiding this comment

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

Could you please share some dataset which shows the problem of this change? So we can take a look on the problem.

This code is here for eliminating of very close images (may happen on live capturing on mobile devices). Blending step with two close images provides unnecessary artifacts, so this threshold is applied here.

Ideally it would be great to provide dedicated parameter for this threshold (probably for the master branch, 3.4 is in the maintenance mode)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants