micjahn/ZXing.Net

how fix to erorr in DecodeMulti

AbdalaMask opened this issue · 5 comments

image
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
using var obj = new QRCodeDetector();

            using var withQr = new Mat(openFileDialog1.FileName, ImreadModes.Color);

            bool detected = obj.DetectMulti(withQr, out var points);
            bool decoded = obj.DecodeMulti(withQr, points, out var decodedStrings, out var straightQrCode);
            List<List<Point>> listOfListOfPoint2D = new List<List<Point>>();
            List<Point> listOfPoint2D = new List<Point>();

            int m = 0;

            for (int x = 0; x < straightQrCode.Length; x++)
            {
                 
                for (int i = 0; i <= 3; i++)
                {
                    listOfPoint2D.Add(new Point(points[m].X, points[m].Y));
                    m++;
                }
                listOfListOfPoint2D.Add(listOfPoint2D);
               
            }

            if (straightQrCode.Length > 0)
            {

                

                openFileTextBox.Invoke(new MethodInvoker(delegate ()
                {
                    openFileTextBox.Text = decodedStrings[0];
                }));
                var s = new Scalar(255, 0, 0);

                withQr.Polylines(  listOfListOfPoint2D, true, s, 3);

                var bs = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(withQr);
                openFileBox.Image = bs;
            }

        }

qr_multi

Please describe the problem in detail. I tried to decode the QR codes with the Windows Forms Demo client application and it works like a charm.
grafik

Can I have a link to the app in the picture?

Maybe the code used in the picture?

The app is available in the source code repository of this project here:
https://github.com/micjahn/ZXing.Net/tree/master/Clients/WindowsFormsDemo

ok good working