-
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
cv::aruco::detectMarkers consumes all available memory when CORNER_REFINE_CONTOUR #2738
Comments
Bug possibly in aruco.cpp:840, branch is taken when both camera matrix and distortion coefficients are provided. |
I have converted the Python code in C++ to be able to run it with a debugger:
Looks like there is an infinite loop here: opencv_contrib/modules/aruco/src/aruco.cpp Lines 805 to 810 in ae4d5d3
When you print the variables, you have:
So you keep adding points in the vector indefinitely when opencv_contrib/modules/aruco/src/aruco.cpp Lines 807 to 808 in ae4d5d3
This is just a quick debugging and I am not interested into debugging it any further. I don't like Aruco and prefer AprilTag. |
Problem probably is that points in nContours are undistorted into contour2f
and later compared to the not-undistorted points in nCorners.
which never yields true. That’s in _refineCandidateLines() |
@catree Thank you for initial investigation! Added a quick workaround to eliminate infinite loop: #2793 (does not close this issue) @sebasth @esopalumpa Feel free to prepare PR with complete fix for this issue. |
System information (version)
Detailed description
cv::aruco::detectMarkers
consumes all available memory whenCORNER_REFINE_CONTOUR
is used and camera distortion parameter are provided. This does not happen if no distortion parameters are provided. This happens in both C++ and in Python. Example program below which demonstrates the issue.I have tested this with with OpenCV versions 4.2.0 and 4.5.0.
Steps to reproduce
Example creates aruco marker and places it in the middle of the image. Dummy camera matrix (focal length is image width) is used, but the issue also present when real images calibrated camera values are used.
Output
Issue submission checklist
answers.opencv.org, Stack Overflow, etc and have not found solution
The text was updated successfully, but these errors were encountered: