QR code: fix false positive detection#19677
Merged
opencv-pushbot merged 1 commit intoopencv:3.4from Mar 5, 2021
Merged
Conversation
Member
|
Does it resolve #19626 ? |
Contributor
Author
Yes, I have updated issue number in PR description |
alalek
reviewed
Mar 4, 2021
| } | ||
| } | ||
| double mean_compactness = compactness / point2f_result.size(); | ||
| double ratio = mean_compactness / min_dist; |
Member
There was a problem hiding this comment.
Please add handling to avoid divisions by zero here.
CV_DbgAssert(!point2f_result.size()); should be enough for the first case.
Contributor
Author
There was a problem hiding this comment.
Thank you
I have added condition for min_dist, but for the first case there is already condition if above
modules/objdetect/src/qrcode.cpp
Outdated
| for (int coeff_epsilon = 1; coeff_epsilon < 10; coeff_epsilon++) | ||
| const int min_dist_between_points = 10; | ||
| const double max_ratio = 1.0; | ||
| for (float coeff_epsilon = 0.1; coeff_epsilon < 10.1; coeff_epsilon+=0.1) |
Member
There was a problem hiding this comment.
Please avoid iterations through "floating-point" vars.
for (int coeff_epsilon_i = 1; coeff_epsilon_i < 101; ++coeff_epsilon_i)
{
const float coeff_epsilon = coeff_epsilon_i * 0.1f;
...
a8f71cb to
125cc79
Compare
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR will fix some cases of false positive detection of QR codes and prevent segmentation fault in
decodeCurved()due to these casesresolves #19626