Skip to content

fix charuco checkBoard#24126

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
AleksandrPanov:fix_charuco_checkBoard
Sep 20, 2023
Merged

fix charuco checkBoard#24126
asmorkalov merged 1 commit intoopencv:4.xfrom
AleksandrPanov:fix_charuco_checkBoard

Conversation

@AleksandrPanov
Copy link
Copy Markdown
Contributor

@AleksandrPanov AleksandrPanov commented Aug 8, 2023

Fixes #23905

checkBoard() is an internal function that checks that the found board has the correct structure

  1. fixed a bug with checking extraneous markers:
                if (find(boardIds.begin(), boardIds.end(), idMaker) == boardIds.end())
                    continue;
  1. fixed an indexing bug:
                const int nearestMarkerId1 = boardIds[nearestMarkerIdx[chId][0]];
                const int nearestMarkerId2 = boardIds[nearestMarkerIdx[chId][1]];
  1. updated docs for getNearestMarkerIdx()/getNearestMarkerCorners()
  2. added checkBoardStructure flag, this flag allows you to return the old behavior or use your custom board structure check.

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

CV_WRAP CharucoParameters() {
minMarkers = 2;
tryRefineMarkers = false;
checkBoardStructure = true;
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 do you need extra flag?

Copy link
Copy Markdown
Contributor Author

@AleksandrPanov AleksandrPanov Aug 18, 2023

Choose a reason for hiding this comment

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

this flag allows you to return the old behavior or use your custom board structure check.

@asmorkalov asmorkalov self-requested a review August 8, 2023 14:43
@asmorkalov asmorkalov added this to the 4.9.0 milestone Aug 8, 2023
@asmorkalov asmorkalov added the pr: needs test New functionality requires minimal tests set label Aug 9, 2023
@AleksandrPanov AleksandrPanov force-pushed the fix_charuco_checkBoard branch from 0c06c07 to cd88f14 Compare August 9, 2023 21:37
@AleksandrPanov AleksandrPanov force-pushed the fix_charuco_checkBoard branch 2 times, most recently from 19d75b9 to 49df8b7 Compare August 18, 2023 08:13
@AleksandrPanov AleksandrPanov marked this pull request as ready for review August 18, 2023 20:45
@AleksandrPanov AleksandrPanov added test and removed pr: needs test New functionality requires minimal tests set labels Aug 19, 2023
@vrabaud
Copy link
Copy Markdown
Contributor

vrabaud commented Aug 29, 2023

I confirm this fixes some tests on our end.

Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

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

👍

@asmorkalov asmorkalov merged commit 224dac9 into opencv:4.x Sep 20, 2023
@asmorkalov asmorkalov mentioned this pull request Sep 28, 2023
@vrabaud
Copy link
Copy Markdown
Contributor

vrabaud commented Oct 2, 2023

@AleksandrPanov , @asmorkalov , getMat() builds a mat so you are taking a reference to a temporary, that is problematic and will not compile with certain flags.

Mat getMat(int idx=-1) const;
getmat returns a Mat, not a Mat&.
It should be const Mat, simply.


original comment from 2023-09-20: 60ae973#r127863372

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.

Detection of multiple ChArUco boards with different IDs in one image broken in 4.8.0

3 participants