-
- Notifications
You must be signed in to change notification settings - Fork 56.4k
fix charuco matchImagePoints #23138
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 charuco matchImagePoints #23138
Conversation
42d97fa to b9dbe13 Compare 69f69e8 to a0ff116 Compare d6b393b to 9bf43c3 Compare ce709d5 to ed8a99d Compare ed8a99d to 697b2ec Compare
asmorkalov left a comment
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.
👍 Looks good!
alalek left a comment
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.
From what other part of OpenCV code did you bring that design pattern?
Looks like we have malformed API design - InputArrayOfArrays is misused here.
/cc @vpisarev
Accessing elements without type checks must be avoided.
be2be26 to 605fbf9 Compare | I fixed most of the issue (also updated docs, added cpp test). The issue of |
bc0cb3b to 890522a Compare 890522a to 4ba06c3 Compare
The problem was in python bindings in
void matchImagePoints(InputArrayOfArrays detectedCorners, InputArray detectedIds, OutputArray objPoints, OutputArray imgPoints).detectedCornersmay include aruco marker corners asvector<vector<Point2f>>orvector<Mat>. AnyMatinvector<Mat>must have 4 rows for 4 corners for one marker (one marker has 4 corners).detectedCornersmay include Charuco corners asvector<Point2f>orMat. Python bindings add extra dimension todetectedCornersand thereforevector<Mat>case is additionally processed for charuco corners.Until the PR merge, you can using custom
matchImagePoints():Use sample from #23139 to see problem.
args:
-w=5 -h=7 -sl=0.04 -ml=0.02 -d=10 -v=choriginal.jpg
With fix:

detectedCornersincludes charuco corners in this case. Python bindings add extra dimension todetectedCornersand therefore without fixdetectedCornersprocessed as aruco marker corners andmatchImagePointsreturns bad values: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.