Skip to content

SIGILL in mcc #3316

Open
Open
@vrabaud

Description

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

float asp = (float)(norm(v2) / norm(v1));
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

Vcart = lines[i].cross(lines[j]);

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:
crop

It might not SIGILL for you but you can display the mentioned cv::Point2f and you will see inf.

Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions