Decoding a picture with more than one QR yields in no result at all

Jun 14, 2013 at 5:23 PM
Edited Jun 14, 2013 at 5:54 PM
Hi there

I really like this project and the available examples. During the last days I tried to create a wp8 app that is able to scan two QR and one EAN-13 at the same time.
I used to use the ClearImage Library for .NET in WPF projects which is able to manage this task on very noisy and skewed images, angels or bad lightening,

On WP8, very often only one of the QR' or the EAN code gets decoded. From time to time, the decoded EAN contains the wrong numbers. I haven't managed to get both the QR and the EAN decoded at the same time or even all the three at the same time.

What I tried as input source was:
  • loading from file
  • GetPreviewBufferY
  • GetPreviewBufferArgb (full size or cropped to a certain viewfinder)
  • image capture (Lumia 920) - full or cropped
Processing using BarcodeReader.DecodeMultiple with all params set/unset like TryHarder, AutoRotate, TryInverted and having only QR and EAN codes activated.

There seems to be no difference (in respect to the results) between having the reader created all the time or only once/per page instance.

The android zxing scanner app recognizes all the codes (one after another) in no time, even if there is another QR partially visible - meanwhile the wp8 app seems to get confused somehow .. takes ages to recognize only one code

Is there any advise on the image quality, noise reduction, view angle that I forgot to test? or is it generally a bad idea trying to decode multiple codes at once using this library?

Thanks for any suggestion!
Jun 14, 2013 at 6:08 PM
Im testing the app using this image

Image
Coordinator
Jun 14, 2013 at 8:52 PM
I tried your sample with the WinForms demo. I have used AutoRotate = False, TryInverted = False and TryHarder = False.
It finds the EAN and the right QR code with one call to DecodeMultiple.
If I try your sample with the online decoder of zxing (http://zxing.org/w/decode) it gives the same results.
Decoding multiple codes at once isn't perfect and needs more optimizations.
There is no need to create the reader instance all the time. You can reuse the first instance.

Because I don't own a WP device I need a dump of the preview buffer. With the dump I can look
deeper into this issue.
Jun 15, 2013 at 12:59 PM
Nice, i wasn't aware of the online decoder.

The lumia 920 has a preview resolution of 480x640px at 96dpi and 24bits depth. Here a dump of a GetPreviewBufferArgb() buffer, filled into a WriteableBitmap (Nuget: WriteableBitmapEx) and saved as jpg -is that ok for you?
2xQR-EAN

GetPreviewBufferY() isn't the best idea for a muli-code-image as you see here:
2xQR-EAN-Y - NV12-format

If I resize the first Image (2xQR + EAN) to 50%, both QRs are recognized by the WinForm-Client (Auto-Rotate & Multiple Codes set). [but non of them by the web Decoder]
2xQR-EAN-Min

Another test image i used for code evaluation: 3x3 QR of which 8 are the same code (GetPreviewBufferArgb)
3x3QR
Coordinator
Jun 17, 2013 at 10:41 PM
Gets the GetPreviewBufferY() call really such a weird result?

The pictures are good samples but I need a real dump of the binary (byte[]) data as well.

Btw. if you only want to decode QR codes there is a decoder class which does a better job in such special cases: QRCodeMultiReader
Jun 20, 2013 at 3:50 PM
Edited Jun 20, 2013 at 4:01 PM
Alright, here is
please use JDownloader if installed for a hassle free experience ;)
Coordinator
Jun 24, 2013 at 9:52 PM
With the following code snippet I can successfully decode 2 QR codes. GetPreviewBufferY works as expected.
      private const string dumpY = "GetPreviewBufferY.bytes.dmp";
      private const int dumpWidth = 640;
      private const int dumpHeight = 480;

      [Test]
      public void Test_GetPreviewBufferY()
      {
         var dumpYData = File.ReadAllBytes(dumpY);
         var luminance = new PlanarYUVLuminanceSource(dumpYData, dumpWidth, dumpHeight, 0, 0, dumpWidth, dumpHeight, false);
         var reader = new BarcodeReader();
         // gives 2 results
         var result = reader.DecodeMultiple(luminance);
      }
But it seems to me that width and height are swapped.
Did you try different rotations of the device?