googlesamples / android-vision

Deprecated: The Mobile Vision API is now a part of ML Kit: Check out this repo:
https://github.com/firebase/quickstart-android/tree/master/mlkit
Apache License 2.0
2.92k stars 1.73k forks source link

Barcode.EAN_13 not recognized #7

Open tobrun opened 9 years ago

tobrun commented 9 years ago

While trying out the sample code:

When I try to scan an EAN_13 barcode:

Also I tried to configure a specific barcode variant, but this resulted in same behaviour:

pm0733464 commented 9 years ago

This may be a camera focus issue -- some of the barcode formats work better when the camera is fully in focus.

Is your app using CameraSource? As discussed in another thread, this initial release does not have an auto camera focus option on CameraSource, but this will be added in a future release. In the meantime, you might try the workaround suggested by Aeefire in this thread:

https://github.com/googlesamples/android-vision/issues/2

jbilbo commented 9 years ago

I don't see the EAN_13 barcode as supported. Maybe that's why? Is it intended?

For 1D Bar Codes, these are: AN-13 EAN-8 UPC-A UPC-E Code-39 Code-93 Code-128 ITF Codabar

Source: http://android-developers.blogspot.co.uk/2015/08/barcode-detection-in-google-play.html

Update1: I tried myself and EAN_13 works, but yeah sometimes (specially when it's too close) because of the focus issue it's hard to read. Update2: Nvm it's listed here as supported: https://developers.google.com/vision/barcodes-overview

pm0733464 commented 9 years ago

We have recently open sourced the CameraSource class:

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

This version includes an auto-focus option, which will probably help.

jainkamini commented 8 years ago

I am new in android .i have try QR_Code sample it is working fine . When I try to scan an EAN_13 barcode it is not working.i add this line in new BarcodeDetector.Builder(context).setBarcodeFormats(Barcode.EAN_13).build(); i Check this link but i an not able to understand this code .can anyone help me how i add this code in my sample code. https://github.com/googlesamples/android-vision/blob/master/visionSamples/barcode-reader/app/src/main/java/com/google/android/gms/samples/vision/barcodereader/ui/camera/CameraSource.java

pm0733464 commented 8 years ago

If you are using CameraSource, you'd enable focus mode by calling this builder method:

https://github.com/googlesamples/android-vision/blob/master/visionSamples/barcode-reader/app/src/main/java/com/google/android/gms/samples/vision/barcodereader/ui/camera/CameraSource.java#L202