Skip to content

QRCodeDetector on android does not decode #24318

@EddyTheCo

Description

@EddyTheCo

System Information

OpenCV version: 4.8.0
Android 11
Android NDK

Detailed description

I am using precompiled libraries of OpenCV taken from these releases.

The precompiled libraries are used by my library using this CMakeLists.txt

This library works well in wasm, and desktop(only tested in linux). But when using Android, I can check that the QRCodeDetector detects the QRCODE but never decodes it.
Also when using auto str=detectAndDecodeCurved(greyImg,corners); corners becomes a 1x4 matrix, what are those numbers?
It is not clear to me what the documentation means with 'vertices of the found QR code quadrangle'. In what unit, what is the reference point? How can you express four vertices in a 2D plane with 4 numbers?

I see that when pointing the camera to a QRCODE corners becomes a 1x4 matrix, so it is detecting something.

Steps to reproduce

std::string MyQRCodeDetector::decode_grey(unsigned char* img,int rows ,int cols)
{
    cv::Mat greyImg = cv::Mat(rows,cols, CV_8UC1, img);

    cv::Mat corners;
    auto str=detectAndDecodeCurved(greyImg,corners);

    qDebug()<<"cols:"<<corners.cols;
    qDebug()<<"rows:"<<corners.rows;
    qDebug()<<"depth:"<<corners.depth();

    for(int i = 0 ; i < corners.rows ; i++)
    {
        for(int j = 0 ; j < corners.cols ; j++)
        {
            qDebug()<<corners.at<float>(i,j);

        }
    }
    if(corners.rows&&corners.cols)
    {
        cv::line(greyImg, cv::Point2i(corners.at<float>(0,0),corners.at<float>(0,1)), cv::Point2i(corners.at<float>(0,2),corners.at<float>(0,1)), cv::Scalar(100,200,155), 11);
        cv::line(greyImg, cv::Point2i(corners.at<float>(0,2),corners.at<float>(0,1)),cv::Point2i(corners.at<float>(0,2),corners.at<float>(0,3)), cv::Scalar(30,100,0), 8);
        cv::line(greyImg, cv::Point2i(corners.at<float>(0,0),corners.at<float>(0,1)), cv::Point2i(corners.at<float>(0,0),corners.at<float>(0,3)), cv::Scalar(150,4,255), 5);
        cv::line(greyImg, cv::Point2i(corners.at<float>(0,0),corners.at<float>(0,3)),cv::Point2i(corners.at<float>(0,2),corners.at<float>(0,3)), cv::Scalar(75,75,75), 2);
    }
    qDebug()<<"STTTTRRR:"<<str;
    return str;
}

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions