Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@AleksandrPanov
Copy link
Contributor

@AleksandrPanovAleksandrPanov commentedJan 15, 2023
edited
Loading

The problem was in python bindings invoid matchImagePoints(InputArrayOfArrays detectedCorners, InputArray detectedIds, OutputArray objPoints, OutputArray imgPoints).

detectedCorners may include aruco marker corners asvector<vector<Point2f>> orvector<Mat>. AnyMat invector<Mat> must have 4 rows for 4 corners for one marker (one marker has 4 corners).

detectedCorners may include Charuco corners asvector<Point2f> orMat. Python bindings add extra dimension todetectedCorners and thereforevector<Mat> case is additionally processed for charuco corners.

Until the PR merge, you can using custommatchImagePoints():

def matchImagePoints(charuco_board, charuco_corners, charuco_ids):    objPoints = []    imgPoints = []    for i in range(0, len(charuco_ids)):        index = charuco_ids[i]        objPoints.append(charuco_board.getChessboardCorners()[index])        # objPoints[-1][0][1] = charuco_board.getRightBottomCorner()[1] - objPoints[-1][0][1]  #  set old axis direction        imgPoints.append(charuco_corners[i])    return np.array(objPoints), np.array(imgPoints)

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:
image

detectedCorners includes charuco corners in this case. Python bindings add extra dimension todetectedCorners and therefore without fixdetectedCorners processed as aruco marker corners andmatchImagePoints returns bad values:

image

Pull Request Readiness Checklist

See details athttps://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 another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the 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

@AleksandrPanovAleksandrPanov mentioned this pull requestJan 15, 2023
6 tasks
@AleksandrPanovAleksandrPanov marked this pull request as ready for reviewJanuary 15, 2023 23:59
@AleksandrPanovAleksandrPanov changed the titlefix matchImagePointsfix aruco matchImagePointsJan 16, 2023
@AleksandrPanovAleksandrPanovforce-pushed thearuco_fix_matchImagePoints branch 5 times, most recently from42d97fa tob9dbe13CompareJanuary 16, 2023 12:14
@AleksandrPanovAleksandrPanov changed the titlefix aruco matchImagePointsfix charuco matchImagePointsJan 16, 2023
@AleksandrPanovAleksandrPanovforce-pushed thearuco_fix_matchImagePoints branch 4 times, most recently from69f69e8 toa0ff116CompareJanuary 26, 2023 22:05
@AleksandrPanovAleksandrPanovforce-pushed thearuco_fix_matchImagePoints branch 2 times, most recently fromd6b393b to9bf43c3CompareFebruary 12, 2023 23:54
@AleksandrPanovAleksandrPanovforce-pushed thearuco_fix_matchImagePoints branch 2 times, most recently fromce709d5 toed8a99dCompareFebruary 13, 2023 17:43
Copy link
Contributor

@asmorkalovasmorkalov left a comment

Choose a reason for hiding this comment

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

👍 Looks good!

AleksandrPanov reacted with thumbs up emoji
Copy link
Member

@alalekalalek left a 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.

@AleksandrPanovAleksandrPanovforce-pushed thearuco_fix_matchImagePoints branch 4 times, most recently frombe2be26 to605fbf9CompareFebruary 15, 2023 14:40
@AleksandrPanov
Copy link
ContributorAuthor

I fixed most of the issue (also updated docs, added cpp test). The issue ofInputArrayOfArrays API design is discussed above in the conversation.

@asmorkalovasmorkalov self-assigned thisApr 6, 2023
@asmorkalovasmorkalov added this to the4.8.0 milestoneApr 6, 2023
@AleksandrPanovAleksandrPanovforce-pushed thearuco_fix_matchImagePoints branch 3 times, most recently frombc0cb3b to890522aCompareApril 20, 2023 21:43
@asmorkalovasmorkalovforce-pushed thearuco_fix_matchImagePoints branch from890522a to4ba06c3CompareApril 27, 2023 09:06
@asmorkalovasmorkalov merged commitaf1c63c intoopencv:4.xApr 27, 2023
@asmorkalovasmorkalov mentioned this pull requestMay 31, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@alalekalalekalalek requested changes

@asmorkalovasmorkalovasmorkalov approved these changes

Assignees

@asmorkalovasmorkalov

Projects

None yet

Milestone

4.8.0

Development

Successfully merging this pull request may close these issues.

3 participants

@AleksandrPanov@asmorkalov@alalek

[8]ページ先頭

©2009-2025 Movatter.jp