-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 iOS barcode scanning is very slow (unusable in some cases) #2060
Comments
I noticed this too, after some scans it looks like its needs more and more time to scan. |
I just want to make it clear that the issue I am describing is not a performance issue as I scan more and more codes. The issue is that on iOS the detection of non-qr codes is very poor. 10x slower than android |
I just tested @mgcrea/vision-camera-barcode-scanner and can confirm that the implementation there that uses the Vision APIs is much better at detecting barcodes than AVFoundation implementation Is using either the Vision APIs or MLKit on iOS an option? In the current state it feels as if the iOS implementation is only good for QR codes |
MLKit on iOS is much better than iOS innner scan speed |
Hey! Great to hear y'all are using my library and it's working fine so far.
I am using the recommended
nice!
This honestly sounds like an iOS 17/Apple bug. Did you try to run this on the latest iOS 17 beta, or on iOS 16 or older?
No, because on iOS this is a separate output that uses a private hardware channel. Using MLKit on iOS would be a significant amount of extra work, and would fall under the Video Pipeline, which means a lot of nested code/ifs that merge to the same codepath. Right now it's separated very clean. Again, I believe this is an Apple bug since QR code scanning is fine. Maybe they'll fix it in an upcoming update (or already fixed it), but try searching for apple bug reports to verify.
Again, not really as this would fall under the Video Pipeline (and requires a significant amount of extra work and a lot of code complicating the setup of the camera pipeline). |
Maybe this can help for fixing the slow IOS barcode scan. |
@celik75 as per the Apple docs; |
You can choose a custom Maybe try passing |
This does not resolve issue for me. Tried passing max video resolution and |
The behaviour has been the same on iOS 16 and 17, very poor performance when scanning anything that isn't a QR code. |
Maybe try place the barcode close the center of camera view and put them in parallel with camera view's top border(don't rotate bar codes) and see if things gets better? Or you can build a MLKit based frame processor to handle the task. Guess I'll be building one when I upgrade to v3 (not happening anything soon though due to, reasons) |
Just wanted to chime in here and say that I too am seeing this issue. Non-QR barcodes take a considerable amount of time to be recognized (in the neighborhood of 8-10 seconds). I've tinkered with And to add something to the discussion, rather than just throwing in a useless "+1":
I've tried iOS 16.4, iOS 17.0, and iOS 17.1 (released today). |
An update - I'm seeing barcodes that fail be recognized when scanned horizontally are consistently recognized when the barcode is turned vertically. The phone orientation is vertical during all of this testing, for what it's worth. |
I mean you guys can test to create a new bare native iOS app and use the Barcode Scanner there ( |
I have the same experience. When I use vision-camera-v2 in our app to scan a barcode, it takes less than 1/100 second. But with vision-camera-v3 (3.6.4) on the same device I have to rotate the phone to fit the barcode vertically. (I guess thus it makes the barcode image larger.) vision-camera-v2:v2.movvision-camera-v3:v3.mov |
@mrousavy when I started this thread I said that it was an apple issue and presented alternatives. Is this ever something you would change so that the performance of this feature is acceptable for barcodes on iOS? Currently it is not for anything other than QR codes. |
@lc-mm to be honest - no. As mentioned previously, the Code Scanner API is available under an react-native-vision-camera/package/ios/Core/CameraSession+Configuration.swift Lines 130 to 149 in 8f986a4
If I wanted to use MLKit for this, I would have to:
Here's the downsides of the video channel approach compared to the
So in short; Yes I know it absolutely sucks that the code scanner is only fast on QR codes for iOS, this is most definitely a bug since I don't think I'm doing anything terribly wrong here. I can try to spend some more time to investigate this in a native app (no React Native) thanks to @ticketscloud for sponsoring me/this! ❤️ |
I can't seem to be able to scan a code 128 (or anything barcode) anymore on iOS. I'm on 3.6.4, any workaround ? Even if I fit the barcode vertically it doesn't work. |
@ecaii We had this issue as well and we've decided to use a frameprocessor plugin: https://github.com/mgcrea/vision-camera-barcode-scanner for the iOS part which is still faster & more reliable |
Indeed it's a good solution ! Thank you, it's indeed fast, whether it be on Android or iOS. |
Have you found any solution , because it is still not working in latest updates @zjkuang |
can you try rotating the Camera to see if that changes anything? Maybe the orientation on the scanner is wrong (e.g. landscape left by default) |
For future visitors of this issue: I had the same issue with very slow barcode scanning in iOS with vision-camera v3. I have upgraded yesterday to v4.0.1 and this solved the issue for me, scanning is now really fast. Thank you @mrousavy great job! |
Great If it works ☑️
…On Fri, Apr 26, 2024 at 2:43 PM Regina ***@***.***> wrote:
For future visitors of this issue: I had the same issue with very slow
barcode scanning in iOS with vision-camera v3. I have upgraded yesterday to
v4.0.1 and this solved the issue for me, scanning is now really fast. Thank
you @mrousavy <https://github.com/mrousavy> great job!
—
Reply to this email directly, view it on GitHub
<#2060 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUNDHHYWFVV7TN3XIJ4GKADY7ILCZAVCNFSM6AAAAAA6JN64H2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZYHE3TKMBWGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
What's happening?
On iOS the native API's are performing very poorly (all devices that I have tested on). The time to scan a regular barcode is so slow and inaccurate compared to Android that uses MLKit. The QR scanning on iOS is fine, but the other types of barcodes (vertical lines, ie: upc/code/etc) I have tested have been almost unusable, what takes android 2 seconds to scan/verify will take iOS almost 10 times as long sometimes.
Some additional context - when I say scan/"verify" we are waiting to see the same code 4 times before we count that as a successful scan.
The framerate on iOS is good, but the time to scan is not adequate.
We were previously using a fork of this library https://github.com/rodgomesc/vision-camera-code-scanner which also uses MLKit on iOS and it was significantly better and matched the Android implementation/performance.
Could iOS be changed to use MLKit instead of the native API's?
Reproduceable Code
Relevant log output
Camera Device
NA
Device
iPhone 13, iPad Mini
VisionCamera Version
3.5.1
Can you reproduce this issue in the VisionCamera Example app?
Yes, I can reproduce the same issue in the Example app here
Additional information
The text was updated successfully, but these errors were encountered: