Skip to content

Conversation

@AleksandrPanov
Copy link
Contributor

@AleksandrPanov AleksandrPanov commented Jan 13, 2023

Removed charuco duplication after move aruco to main repo.

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 force-pushed the remove_duplication_from_aruco branch 2 times, most recently from f467f0a to 4b7d030 Compare January 13, 2023 09:12
@AleksandrPanov AleksandrPanov force-pushed the remove_duplication_from_aruco branch from 4b7d030 to 10c188c Compare January 16, 2023 00:08
@AleksandrPanov AleksandrPanov marked this pull request as ready for review January 16, 2023 00:10
@asmorkalov asmorkalov self-requested a review January 18, 2023 14:38
// get object and image points for the solvePnP function
Mat objPoints, imgPoints;
board->matchImagePoints(charucoCorners, charucoIds, objPoints, imgPoints);
solvePnP(objPoints, imgPoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess);
Copy link
Contributor

Choose a reason for hiding this comment

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

solvePnP throws exception, if there are no enough points.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added points check:
if(charucoIds.getMat().total() < 4) return false;

Copy link
Contributor

Choose a reason for hiding this comment

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

I propose to add try-catch block and return false in case of exception. The function did not throw exceptions before and should not do it after the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add try catch:

    try {
        solvePnP(objPoints, imgPoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess);
    }
    catch (const cv::Exception& e) {
        CV_LOG_WARNING(NULL, "estimatePoseCharucoBoard: " << std::endl << e.what());
        return false;
    }

@asmorkalov asmorkalov self-assigned this Jan 23, 2023
@AleksandrPanov AleksandrPanov force-pushed the remove_duplication_from_aruco branch from 10c188c to fc0af69 Compare January 23, 2023 22:42
@AleksandrPanov AleksandrPanov force-pushed the remove_duplication_from_aruco branch from fc0af69 to 1f713fb Compare January 24, 2023 14:37
@asmorkalov asmorkalov merged commit 529131e into opencv:4.x Jan 26, 2023
@alalek alalek mentioned this pull request Jan 28, 2023
@asmorkalov asmorkalov mentioned this pull request May 31, 2023
@rurban
Copy link

rurban commented Mar 28, 2024

This caused a regression in interpolateCornersCharuco, which does not detect the markers anymore.
There need to be more testcases added, we can contribute some from https://github.com/SpexAI/calibpy/
See SpexAI/calibpy#2

@asmorkalov
Copy link
Contributor

@AleksandrPanov could you take a look?

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.

4 participants