micjahn / ZXing.Net

.Net port of the original java-based barcode reader and generator library zxing
Apache License 2.0
2.65k stars 663 forks source link

Don't decode QR_CODE #556

Open kkkaktusss opened 3 months ago

kkkaktusss commented 3 months ago

Hi, i have a bit question. When I try to decode image, barcodereader can't find a QR_CODE format, but in "https://zxing.org" this type is recoginzed(attach a proof in picture). My code return EAN_8, UPC_E, but not a QR_CODE. var reader = new BarcodeReader() { AutoRotate = true}; reader.Options.TryHarder = true; reader.Options.PossibleFormats = new BarcodeFormat[] { BarcodeFormat.QR_CODE, BarcodeFormat.EAN_8, BarcodeFormat.UPC_E }; var result2 = reader.DecodeMultiple(imageMat); 2024-03-19_14-57-53

photo_2024-03-19_14-55-52

Can you help me?

axxel commented 3 months ago

Can you post the QRCode image itself that fails to decode?

kkkaktusss commented 3 months ago

i fixed that. Now, i push in zxing crop image and that worked. But anyway, why zxing recognize multiformat, if i push only qr_code type ?

axxel commented 3 months ago

i fixed that. Now, i push in zxing crop image and that worked. But anyway, why zxing recognize multiformat, if i push only qr_code type ?

Well, with the reader.Options.PossibleFormats = new BarcodeFormat[] { BarcodeFormat.QR_CODE, BarcodeFormat.EAN_8, BarcodeFormat.UPC_E }; you explicitly look for EAN_8 as well. The reason you are getting a false positive EAN_8 is because of the quality of the EAN_8 detector. I assume the one used by ZXing.NET is still the same as the one implemented in the original Java ZXing library. I'm the maintainer of the zxing-cpp project and have reimplemented the EAN_8 detector/decoder (among others) which resulted in this specific case in a substantially reduced false positive rate. There is a .NET wrapper available as well: https://www.nuget.org/packages/ZXingCpp