1

I have been trying to test the new Vision API and got the multi-tracker app running in Android Studio.

I am running the sample app on my phone, but I am not able to detect any barcodes. I have tested ISBN codes, QR codes, and faces. Both with large images due to the focusing issue; however, I don't see anything happening with detection.

What should I expect to see? How do I get barcodes detected from the sample app?

pm0733464
  • 2,862
  • 14
  • 16
Christopher Rucinski
  • 4,737
  • 2
  • 27
  • 58
  • Do you see the same error in the log as described here: http://stackoverflow.com/questions/32611471/after-some-time-barcode-scanner-throws-java-lang-unsatisfiedlinkerror? – mohlendo Sep 18 '15 at 14:23
  • @mohlendo No. I get no error message. I just get my camera preview, but no detections at all – Christopher Rucinski Sep 18 '15 at 14:35

2 Answers2

2

I would guess that the reason that you aren't detecting anything with the sample app is that the vision libraries weren't successfully downloaded to your device. This will happen if the device is in a "low storage" state. We recently updated the samples to check for this condition and provide feedback to the user. For example:

// Check for low storage.  If there is low storage, the native library will not be
// downloaded, so detection will not become operational.
IntentFilter lowstorageFilter = new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW);
boolean hasLowStorage = registerReceiver(null, lowstorageFilter) != null;

if (hasLowStorage) {
    Toast.makeText(this, R.string.low_storage_error, Toast.LENGTH_LONG).show();
    Log.w(TAG, getString(R.string.low_storage_error));
}

https://github.com/googlesamples/android-vision/blob/master/visionSamples/photo-demo/app/src/main/java/com/google/android/gms/samples/vision/face/photo/PhotoViewerActivity.java#L91

If you are encountering this, freeing up space on the device should do the trick.

pm0733464
  • 2,862
  • 14
  • 16
0

I had this exact problem, and it turned out my camera just needed a lot of light.

I was testing with an inexpensive Motorola MotoE phone. It couldn't detect anything until I but the barcode under a fairly bright light. Then it worked fine.

Edited to add:

I found that going with the default requested preview size greatly increased the reliability of my cheap little phone:

 mCameraSource = new CameraSource.Builder(getApplicationContext(), multiDetector)
                .setFacing(CameraSource.CAMERA_FACING_BACK)
                //.setRequestedPreviewSize(1600, 1024)
                .setRequestedFps(15.0f)
                .build();

see https://developers.google.com/android/reference/com/google/android/gms/vision/CameraSource.Builder.html#setRequestedPreviewSize(int, int)

Jim In Texas
  • 1,524
  • 4
  • 20
  • 31
  • Could someone help me with the similar question related to android-vision? http://stackoverflow.com/questions/32715573/media-recorder-with-google-vision-api – muneikh Sep 23 '15 at 09:21