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

Closed
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
5 changes: 2 additions & 3 deletions modules/stitching/src/matchers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,9 +766,8 @@ void BestOf2NearestMatcher::match(const ImageFeatures &features1, const ImageFea
// using Invariant Features"
matches_info.confidence = matches_info.num_inliers / (8 + 0.3 * matches_info.matches.size());

// 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;
/* should we remove matches between too close images? */
// 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)


// Check if we should try to refine motion
if (matches_info.num_inliers < num_matches_thresh2_)
Expand Down