-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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 CORNER REFINE CONTOUR #3186
fix CORNER REFINE CONTOUR #3186
Conversation
2e003af
to
6004438
Compare
for (int i = 0; i < 4; i++) | ||
CV_Assert(cornerIndex[i] != -1); |
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.
Added check that each of the four corners is found.
// saves extra group into corresponding | ||
if( !cntPts[4].empty() ){ | ||
CV_CheckLT(group, 4, "FIXIT: avoiding infinite loop: implementation should be revised: https://github.com/opencv/opencv_contrib/issues/2738"); |
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.
If each (or at least one) of the 4 corners is found, then group
will not be equal to 4.
6004438
to
77e648f
Compare
* @param cameraMatrix optional input 3x3 floating-point camera matrix | ||
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ | ||
* @param distCoeff optional vector of distortion coefficients | ||
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements |
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.
I propose to add reference to undistortPoints
and fisheye::undistortPoints
to @sa
. And also add note like "The function does not correct lens distortion or takes it into account. It's recommended to undistort input image with corresponging camera model, if camera parameters are known."
484e030
to
7fa02c4
Compare
7fa02c4
to
ef980e7
Compare
fix cv::aruco::detectMarkers consumes all available memory when CORNER_REFINE_CONTOUR #2738
The problem is that
undistortPoints()
is missing fornCorners
. Therefore, the algorithm does not find any corner points:The most logical solution is to make
undistort()
for the original image and look for ArUco markers on an undistorted image.Also added a check that each of the four corners is found to avoid an infinite loop.
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.