-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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 aruco _filterTooCloseCandidates #2900
Conversation
_filterTooCloseCandidates was occasionally not choosing the biggest contour of a candidate group. Firstly, if the biggest contour of a candidate group happened to be the first candidate of that group, it would never be chosen due to the comparison loop skipping it. Secondly, contour sizes were being compared by their circumference (via counting the number of points in a contour) rather than area. In some cases it is possible for a smaller candidate to have more points than a bigger one. This was fixed by comparing the contour area as defined by the contour's corners.
This might be related to the incorrect settings of the threshold windows described here #2811 . Using the settings described there might solver your issue. |
Prior to making this patch, I was also able to work around the problem by adjusting the adaptive thresholding parameters. Doing so eliminates the inner contours entirely, and as a result the bugs in _filterTooCloseCandidates are mitigated. While it is possible to to work around specific cases by adjusting the adaptive thresholding parameters, doing so may adversely affect performance in other cases. This patch is about fixing two underlying issues in _filterTooCloseCandidates, the function's entire purpose is to filter out these "inner contours". |
hi @spirraw :) |
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.
Thank you 👍
_filterTooCloseCandidates was occasionally not choosing the biggest
contour of a candidate group.
Firstly, if the biggest contour of a candidate group happened to be
the first candidate of that group, it would never be chosen due to the
comparison loop skipping it.
Secondly, contour sizes were being compared by their circumference
(via counting the number of points in a contour) rather than area.
In some cases it is possible for a smaller candidate to have more
points than a bigger one. This was fixed by comparing the contour
area as defined by the contour's corners.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.