afriscic / BarcodeScanning.Native.Maui

Barcode scanning library for .NET MAUI
https://www.nuget.org/packages/BarcodeScanning.Native.Maui
MIT License
157 stars 30 forks source link

Issue scanning PDF417 barcodes #64

Open amolds opened 3 months ago

amolds commented 3 months ago

We are finding that scanning PDF417 barcodes is very problematic. In most cases the scan never occurs. In the rare cases we can get a scan to occur it takes a lot of slowly repositioning the barcode to the point the scan takes place.

Are there any known settings or things we can try to help improve scanning PDF417 barcodes? We rely on this feature heavily.

Thanks.

afriscic commented 3 months ago

Hello. What device and OS do you use? Can you provide a sample barcode?

On my device (Oneplus 7 PRO, Android 12) i find it is best to scan on High quality. On Medium you need to put the device quite close and on Highest the barcode scanning isn't consistent for some reason. Unfortunately I don't have much experience with iPhones but they were usually better at scanning than Android phones.

amolds commented 3 months ago

I used your sample app - the aim mode helped a lot as did setting the CaptureQuality to High. I'm able to scan an OR DL, however, TX DL does not seem to scan. Tried on both Android Pixel 6 and iPhone 13. Both DLs are PDF417 format.

afriscic commented 3 months ago

Aim mode doesn't really do anything to improve scanning performance. It just takes all detected barcodes and removes all of them that don't have their BoundingBox in the centre of the screen.

Sorry, I'm from Europe, and if I understand correctly you scan the code that is on US drivers licence, so I guess you can't share exact barcode that doesn't work. It would be very helpful for debugging if you can generate an example PDF417 barcode with data that would be on the drivers licence and that doesn't work. In my country PDF417 barcodes are popular for automatic payment of bills and I haven't had a barcode not detected. But their encoded data is less complex.

It could happen that the encoded data is crashing the app but it is really unlikely as I'm doing minimal processing on encoded data. But than again it is weird that it can't be detected on both iOS and Android...

TLDR It would be really useful to have an example of a barcode that isn't working.

amolds commented 3 months ago

@afriscic would you be interested in contacting me directly; amolds@hotmail.com for more details about this? Thx

amolds commented 3 months ago

@afriscic Attached is a sample PDF417 that scans fine with QR reader, however, it does not scan with this code. Thoughts?

DL Barcode-Reatiler (002).pdf

afriscic commented 3 months ago

Thank you for sharing. I found a bug on iOS/MacCatalyst that would prevent scanning PDF417 barcodes if you set BarcodeSymbologies to PDF417 only. I'll publish a new release later today. On my Android phone (Oneplus 7 Pro, Android 12) the barcode is scanned correctly on current version.

amolds commented 3 months ago

I have a Pixel 6 and am on 1.5.2 however the barcode still won't scan for me.

afriscic commented 3 months ago

The only thing I can suggest to you is to try if to clone this repository and try with BarcodeScanning.Test to see if this will work as i can't replicate this.