Skip to content

fix refineDetectedMarkers#24139

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
AleksandrPanov:fix_refineDetectedMarkers
Sep 5, 2023
Merged

fix refineDetectedMarkers#24139
asmorkalov merged 1 commit intoopencv:4.xfrom
AleksandrPanov:fix_refineDetectedMarkers

Conversation

@AleksandrPanov
Copy link
Copy Markdown
Contributor

@AleksandrPanov AleksandrPanov commented Aug 10, 2023

Fixes #24127

To refine corners of ArUco markers we need to call matchImagePoints() from base class Board. The method matchImagePoints() implemented in Pimpl and we need to create temp Board object.

Pull Request Readiness Checklist

See details at https://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

@AleksandrPanov AleksandrPanov added bug category: objdetect pr: needs test New functionality requires minimal tests set labels Aug 10, 2023
OutputArray undetectedMarkersIds) {
Mat rvec, tvec; // first estimate board pose with the current avaible markers
Mat objPoints, imgPoints; // object and image points for the solvePnP function
board.matchImagePoints(detectedCorners, detectedIds, objPoints, imgPoints);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why does it change the function behaviour?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The issue #24127 uses CharucoBoard and ChArUco board call matchImagePoints for charuco corners, but to refine ArUco markers we need to call matchImagePoints for ArUco corners. The method matchImagePoints implemented in Pimpl and we need to create Board object.

refineDetectedMarkers must always call matchImagePoints from the base class Board.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It should be added to the implementation as comment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@AleksandrPanov Please add this information to the code as comment. Current comment is not informative.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

reworked

@asmorkalov asmorkalov added this to the 4.9.0 milestone Aug 10, 2023
@AleksandrPanov AleksandrPanov force-pushed the fix_refineDetectedMarkers branch from 6c7cffa to 934b1a6 Compare August 20, 2023 23:16
@AleksandrPanov AleksandrPanov added test and removed pr: needs test New functionality requires minimal tests set labels Aug 20, 2023
@AleksandrPanov AleksandrPanov marked this pull request as ready for review August 20, 2023 23:18
@asmorkalov asmorkalov requested a review from VadimLevin August 21, 2023 06:38
@AleksandrPanov AleksandrPanov force-pushed the fix_refineDetectedMarkers branch from 934b1a6 to ca52704 Compare September 4, 2023 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RefineDetectedMarkers fails if cameraMatrix is given as a param

3 participants