0

I trying to determine if Google's Mobile-Vision API for reading barcodes is going to allow me to meet my requirements.

The problem I am facing currently is that I have a specific barcode that needs to be scanned. The barcode will be printed out next to other barcodes. The API is detecting the 3 barcodes as you can see in the image below: enter image description here

The problem is that when I try to select the middle barcode, either the top or bottom barcode data is returned to the onActivityResult from the sample app. So far I have tried to increment the setRequestedFps to 60. That only detects barcodes faster.

My question is, does anyone know how to improve the accuracy when the user selects from a group of barcodes as the image I have presented?

Any help will be greatly appreciated.

TerNovi
  • 390
  • 5
  • 16

2 Answers2

1

It looks like you're talking about the sample app, the source for which you can find here. Notice the TODO on line 335 (in onTap) -- unfortunately, the sample code just returns a random barcode result:

https://github.com/googlesamples/android-vision/blob/master/visionSamples/barcode-reader/app/src/main/java/com/google/android/gms/samples/vision/barcodereader/BarcodeCaptureActivity.java

Try modifying the sample to select the barcode whose bounding rectangle contains the tap point.

pchx
  • 86
  • 1
  • Yes I am referring to the sample project. I realized that they did have the TODO line :(. This is good answer though I will accept since it explains why there is no accuracy when you select from a group of barcodes. Thanks. – TerNovi Sep 30 '16 at 15:03
  • 1
    I have a patch that should address this issue, if you'd like to test it out: https://github.com/googlesamples/android-vision/pull/135 – pchx Sep 30 '16 at 21:42
  • I just checked out your pull request. That is really useful stuff. I tested it out and it seems to be working great. Thank you! – TerNovi Oct 03 '16 at 14:43
0

You can set the barcode type when detecting, so you'll get the one in the middle. https://developers.google.com/android/reference/com/google/android/gms/vision/barcode/BarcodeDetector

Another solution I can see is use the (x, y) coordinates to find the middle one.

liuyl
  • 165
  • 7
  • I don't think neither of those solutions will solve the problem described here. I was refering to the middle barcode as an example. But in reality all 3 of the barcodes contain useful information in my requirement. So I can't just specify to detect only the middle barcode. I also can't specify to only read the barcode positioned in a set range of x and y. – TerNovi Sep 27 '16 at 18:12