capacitor-community / barcode-scanner

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

Ability to adjust focus #160

Closed simengjermundsen closed 1 year ago

simengjermundsen commented 1 year ago

On an iPhone 14 Pro with iOS 16 I am having great difficulty scanning regular binary codes. There is no autofocus, so I have to keep the barcode far away from the camera to get it in focus, but then the barcodes appear very small and the reader has great difficulty reading them.

Any chance the ability to set focus area or something similar could be added?

thegnuu commented 1 year ago

I have the same issue on my 14 Pro Max, but as far as I am able to tell now this issue is more related to the current camera issues of those devices. I have the same issue in other barcode-scanning apps at the moment, the same Apps are working on the iPhone 12 and 13 without issues. I will have a look at it, but I guess our only "solution" is wait for a fix from Apple on this one.

simengjermundsen commented 1 year ago

Ok! Thank you for looking into it :)

Btw: I have been able to minimize the problems by making sure to scan the barcode in the exact center of the screen. On other devices this has not been as important, but now it seems I have to be scanning the code in the exact center.

thegnuu commented 1 year ago

What kind of code are you trying to scan?

simengjermundsen commented 1 year ago

Mostly EAN.

thegnuu commented 1 year ago

Hmm, yeah - 1D codes are an issue anyways...

I created a mlkit branch, if you are willing to test it out. This should work way better with 1D codes.

But currently only the iOS version is partally implemented.

simengjermundsen commented 1 year ago

Thanks!

I will have a look :)

ian-bolton commented 1 year ago

Is it the same issue referenced here? https://github.com/expo/expo/issues/19472#issuecomment-1284810455

thegnuu commented 1 year ago

@digitalrepublic Thank you for the link, I will have a look at it :)

thegnuu commented 1 year ago

@simengjermundsen & @digitalrepublic

I updated the ml-kit branch with a new camera selection. Now the autofocus is enabled and if available, the triple or dual camera is used which should provide way better results.

Unfortunately I have only an iPhone 14 to test, if anyone of you has an older device without a triple cam it would be awesome if you find time to test it out :)

ian-bolton commented 1 year ago

Thanks, I'll pull the new version and let you know what I find

thegnuu commented 1 year ago

@digitalrepublic sounds good, just be aware that not everything is implemented on iOS... I am currently cleaning everything up :)

thegnuu commented 1 year ago

v5.0.0-beta.1 of the ml-kit implementation is now available. It should work better as the previous versions, at least autofocusing seems to work pretty good on my devices.