Mobile Vision API reads incorrect barcodes
Recently I’ve been doing some android barcode scanning apps. EVERYTHING WAS FINE UNTIL I REALIZED THAT THE SAME APP MY FRIEND MADE ON IOS WAS MUCH BETTER AT DETECTING BARCODES. The Google Mobile Vision API often makes errors when the real barcode is “12345…” , it detects something like “72345…” barcode. Is this a common problem? Is there any solution?
This barcode is well detected when I put the device on top, but after any small action, I will most likely get the wrong code.
Solution
I’ve found that not using the first match and instead applying a simple debounce strategy works well. For example, I only consider a valid match after the barcode appears in 3 consecutive frames.
This can be easily done in Custom Detector<Barcode>
using com.google.android.gms.vision.barcode.BarcodeDetector
internally.
It slows down the detection slightly, but makes them more reliable.