3

我正在分析 ocr-reader 示例项目:https ://github.com/googlesamples/android-vision/tree/master/visionSamples/ocr-reader

目标是用 Android Vision 替换我为 Android(使用 OpenCV 和 Tesseract)定制的“文本到图像”实现。

我找不到任何方法为 OCR 处理器应用高级配置。例如,在我的应用程序中,只允许使用一组预定义的符号。为此,我在我的应用程序中使用以下代码:

api.SetVariable("tessedit_char_whitelist", "ABJOKEA1234");

例如,这有助于避免 0 和 O 之间的混淆。

有没有办法用 android-vision 做到这一点?在构建 TextRecognizer 时我没有看到任何选项:

TextRecognizer textRecognizer = new TextRecognizer.Builder(context).build();

总的来说,Google 是否计划扩展库的可配置性?例如:

  • 源图像的裁剪
  • 提供自定义 OCR 培训文件

或者它应该保持一个简单的库,只有共同的功能?

谢谢你的帮助!

4

1 回答 1

0

我也在努力,我正在尝试制作一个具有移动视觉的名片阅读器,到目前为止,当检测到文本时,我正在使用实时生成的字符串检查 if 条件。

  if (mText == null) {
            return;
        }
        if(mText.getValue().contains("@") && mText.getValue().contains(".") && !mText.getValue().equals(mText.getValue().toUpperCase())){
            Log.e("mTextemail",mText.getValue());
            email=mText.getValue();
        }
        if (mText.getValue().startsWith("+")|| mText.getValue().startsWith("0")&& mText.getValue().contains("+-0123456789/-#")&& !mText.getValue().contains("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")){
            Log.e("mTextphone",mText.getValue());
            phone=mText.getValue();
        }
        if (!mText.getValue().contains("ABCDEFGHIJKLMNOPQRSTUVWXYZ")&& !mText.getValue().contains("0123456789-/#") && !mText.getValue().contains("abcdefghijklmnopqrstuvwxyz")){
            Log.e("mTextcompanyName",mText.getValue());
            companyName=mText.getValue();
        }if(mText.getValue().startsWith("ABCDEFGHIJKLMNOPQRSTUVWXYZ" )&& mText.getValue().endsWith("abcdefghijklmnopqrstuvwxyz")){
            name=mText.getValue();
        }
        if(name ==null){
            name="Was not specified";
        }
        if(email ==null){
            email="Was not specified";
        }
        if(phone ==null){
            phone="Was not specified";
        }
        if(companyName ==null){
            companyName="Was not specified";
        }

它以 70% 的准确率打印日志,也许我们可以互相帮助,而且我希望这些正确的日志显示在我使用过界面但它不起作用的活动中。如果您有任何发现的提示或技巧,请分享。

于 2016-08-24T08:37:32.140 回答