OpenCVForUnity
OpenCVForUnity copied to clipboard
QRCode detection has got a poor accuracy.
The QRCode Detector draws line on every possible objects even a water bottle!...
I tried the same image with python and ti works fine. Why is that so?
Here is my code,
Mat grayMat = new Mat ();
Imgproc.cvtColor (qrMat, grayMat, Imgproc.COLOR_RGBA2GRAY);
Mat points = new Mat ();
bool result = this.cvQrCodeDetector.detect(grayMat,points);
if (result)
{
float[] points_arr = new float[8];
points.get (0, 0, points_arr);
Imgproc.line (qrMat, new Point (points_arr [0], points_arr [1]), new Point (points_arr [2], points_arr [3]), new Scalar (255, 0, 0, 255), 2);
Imgproc.line (qrMat, new Point (points_arr [2], points_arr [3]), new Point (points_arr [4], points_arr [5]), new Scalar (255, 0, 0, 255), 2);
Imgproc.line (qrMat, new Point (points_arr [4], points_arr [5]), new Point (points_arr [6], points_arr [7]), new Scalar (255, 0, 0, 255), 2);
Imgproc.line (qrMat, new Point (points_arr [6], points_arr [7]), new Point (points_arr [0], points_arr [1]), new Scalar (255, 0, 0, 255), 2);
counter += 1;
Imgcodecs.imwrite(Application.persistentDataPath + "/"+counter+".png", qrMat);
}
There does not seem to be any problem with your code.
Could you please show us the QR image that is not detectable? Or you can send it to us by email form. https://enoxsoftware.com/opencvforunity/contact/technical-inquiry/