capacitor-community / barcode-scanner

A fast and efficient (QR) barcode scanner for Capacitor
MIT License
436 stars 172 forks source link

Unable to scan barcodes rotated 90 degrees #124

Closed interfacersa closed 1 year ago

interfacersa commented 2 years ago

I was wondering if you have capability to scan barcodes which are rotated 90 degrees(on their side). The other ionic scanner does allow it but does not allow continuous scanning like this one?

thegnuu commented 2 years ago

@interfacersa About which kind of codes are you talking?

interfacersa commented 2 years ago

Barcodes and QR Codes. Basically any type you currently support

thegnuu commented 2 years ago

All the 2D barcodes should not be a problem since they are designed for exactly this. With 1D barcodes and the current implementations used in this plugin it is not really possible unfortunately.

interfacersa commented 2 years ago

Not sure if you have seen this https://github.com/journeyapps/zxing-android-embedded/issues/211

xulihang commented 2 years ago

ZXing cannot read rotated barcodes. You can try this capacitor plugin using Dynamsoft Barcode Reader which can read 1D barcodes in any angle.

interfacersa commented 2 years ago

Thanks ill try this

khavnu commented 2 years ago

Thanks ill try this

barcode With this vertical barcode, this is my solution: Use RxJava or Coroutines to decode origin bitmap(vertical barcode), if result is null -> rotate bitmap (90 degree)and decode again. I've done with this solution, i work perfectly! Only need rotate 90 degree(rotate 270 and 90 is same result)

Psuedo Code: decodeTask() {

result = decodeOriginBitmap()

wait for result If(result is null) { decodeRotate90Bitmap } } Hope this help !

thegnuu commented 2 years ago

Just to let you know, I am currently working on a PoC to use Googles ML Kit in this plugin. With my current implementation I am able to read this code without any issues in any angle, this should resolve most of the issues regarding 1D codes.

I will let you know once I have a version ready to test, currently I am implementing the iOS part since I am more used to develop with swift than Java at the moment.

thegnuu commented 1 year ago

I will close this issue since the ml-kit version is now in its end-stages and I am cleaning up "old" issues. I have pretty good results scanning codes in any directions on this branch (on android it works great, there are some autofocus issues on ios I have to address)