Google Vision API 文本识别器不工作 [英] Google Vision API Text Recognizer is not working

查看:75
本文介绍了Google Vision API 文本识别器不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Google 视觉 API 从任何对象(如报纸或墙上的文字)中读取文本.我尝试了来自 Google 开发者网站的相同示例,但我的文本识别器总是在 IsOperational 函数上返回 false.我在 Blackberry keyone 上测试过,也在 Moto x 上测试过,运行正常.

I have used Google vision API to read text from any object like newspaper or text in wall. I have tried same sample from Google developer website but my Text Recognizer always return false on IsOperational function. am tested on Blackberry keyone and also tested on Moto x play its working fine.

Gradle 文件:编译'com.google.android.gms:play-services-vision:11.0.4'

谁能帮我解决这个问题.提前致谢

Can anyone help me on this. Thanks in Advance

TextRecognizer textRecognizer = new TextRecognizer.Builder(context).build();
textRecognizer.setProcessor(new OcrDetectorProcessor(mGraphicOverlay, OcrCaptureActivity.this));
if(!textRecognizer.isOperational()) { 
  Log.e("TextRecog","Not Operational"); IntentFilter lowstorageFilter = new 
  IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW); boolean hasLowStorage = registerReceiver(null, lowstorageFilter) != null;
}

推荐答案

在您的应用清单中添加视觉 API 的元数据

add the vision api's metadata on your App manifest

 <meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />
<meta-data
    android:name="com.google.android.gms.vision.DEPENDENCIES"
    android:value="ocr"/>

这篇关于Google Vision API 文本识别器不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆