Search code examples
androidgoogle-cloud-platformgoogle-cloud-vision

Google Cloud Vision API returning nothting for Type = TEXT_DETECTION


I'm working on an OCR android application using Google Cloud Vision API

For testing I've used the sample application which is provided by Google

https://github.com/GoogleCloudPlatform/cloud-vision/tree/master/android/CloudVision

I've tested it for type "LABEL_DETECTION" and it works fine

I've updated this sample application to work for type "TEXT_DETECTION" instead of "LABEL_DETECTION"

I've tested it using this image and it return "nothing" result

[ocr_image]

enter image description here

Appreciate if anyone knows what is the issue

Thanks in advance


Solution

  • I had the same problem. In my case it happened because I forgot to change convertResponsetoString method.

    try to change this:

    List labels = response.getResponses().get(0).getLabelAnnotations();

    to this:

    List labels = response.getResponses().get(0).getTextAnnotations();