opencv_contrib
opencv_contrib copied to clipboard
SIGILL in mcc
System information (version)
- OpenCV => 4.6.0 (HEAD)
- Operating System / Platform => Linux
- Compiler => clang 13
Detailed description
Some found corners lead to inf being computed which screws up the code.
To be precise: both v1 and v2 end up containing -inf which leads to a SIGILL at https://github.com/opencv/opencv_contrib/blob/9d0a451bee4cdaf9d3f76912e5abac6000865f1a/modules/mcc/src/checker_detector.cpp#L1109 because you are computing inf/inf (if you have throwing NaNs).
A solution could be to add if (Vcart.z == 0) Vcart.z += 0.0001; after https://github.com/opencv/opencv_contrib/blob/9d0a451bee4cdaf9d3f76912e5abac6000865f1a/modules/mcc/src/bound_min.cpp#L168
I am not familiar with the code to know whether it makes sense though.
Steps to reproduce
Run the following code
#include "opencv2/imgcodecs.hpp"
#include "opencv2/mcc.hpp"
int main(int, char**argv){
cv::Mat mat = cv::imread("./crop.jpeg");
cv::Ptr<cv::mcc::CCheckerDetector> detector = cv::mcc::CCheckerDetector::create();
detector->process(mat, cv::mcc::TYPECHART::MCC24);
}
with the image:

It might not SIGILL for you but you can display the mentioned cv::Point2f and you will see inf.
Issue submission checklist
- [x] I report the issue, it's not a question
- [x] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- [x] I updated to the latest OpenCV version and the issue is still there
- [x] There is reproducer code and related data files: videos, images, onnx, etc