barcode-scanner icon indicating copy to clipboard operation
barcode-scanner copied to clipboard

Unable to scan barcodes rotated 90 degrees

Open interfacersa opened this issue 2 years ago • 8 comments

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?

interfacersa avatar May 10 '22 12:05 interfacersa

@interfacersa About which kind of codes are you talking?

thegnuu avatar May 10 '22 14:05 thegnuu

Barcodes and QR Codes. Basically any type you currently support

interfacersa avatar May 10 '22 19:05 interfacersa

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.

thegnuu avatar May 11 '22 06:05 thegnuu

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

interfacersa avatar May 13 '22 06:05 interfacersa

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

xulihang avatar May 13 '22 08:05 xulihang

Thanks ill try this

interfacersa avatar May 13 '22 09:05 interfacersa

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 !

khavnu avatar May 14 '22 01:05 khavnu

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 avatar Jun 17 '22 12:06 thegnuu

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)

thegnuu avatar Nov 24 '22 09:11 thegnuu