Spelt / ZXing.Delphi

ZXing Barcode Scanning object Pascal Library for Delphi VCL and Delphi Firemonkey
Apache License 2.0
479 stars 204 forks source link

These barcodes are not recognized #47

Closed csm101 closed 7 years ago

csm101 commented 7 years ago

Hi, these QRCodes are not recognized at all by ZXing (one even raises a "divide by zero" error) I think that they aren't recognized even by the original ZXing.net. A workaround is to use the TDecodeHintType.PURE_BARCODE and TDecodeHintType.TRY_HARDER_WITHOUT_ROTATION hints, but I don't think they can be used if the image is acquired by a camera (which is not the case of my application, so I am fine with them)

Only 3 barcodes on a sample of 100 barcodes (all using the same qr-code format, just different content) show these problems.

P.s: the "divide by zero" exception does not happen in .net because in .net float divide by zero returns "NaN " without raising any exception.

1 02365230594cog00000059 02365230594cog00000109

Spelt commented 7 years ago

Hi Carlo,

Thanks!

It apparently is by design. See comments from Sean Owen: https://github.com/zxing/zxing/issues/I216

Wondering now why PURE_BARCODES is not the deafult because everything gets grayscaled and binarized anyway. Huge colour pics get scanned too. Did also some speed testing and there is no real word difference.

About the exception: I released a small patch for the "divide by zero" exception in your cases. Somehow it does also not happen in a FM application. I also added an extra unit test. See: https://github.com/Spelt/ZXing.Delphi/commit/cbcffc6c14d410ca5599e0c80ad64f9524a070b2