javaandroidgoogle-vision

Incorrect barcode read by Mobile Vision API


Recently I've been doing some kind of Android barcode scanning app. Everything was fine until I realized that the same app made by my friend on IOS is much better at detecting barcodes. Google Mobile Vision API is often wrong, it detects barcodes like "72345...." when a real barcode is "12345..." . Is this a general problem? Are there any solutions?

Sample barcode: enter image description here

This barcode is detected fine when I keep my device above, but after any small move there is big chance to get incorrect code.


Solution

  • I found that not using the first match but applying a simple debounce strategy works pretty well. For example I only consider a valid match after a barcode appears in 3 continuous frames. This can be easily done in a custom Detector<Barcode> that uses a com.google.android.gms.vision.barcode.BarcodeDetector internally. It slows down detection a bit but makes them more reliable.