【问题标题】:Set OCR whitelist in the TextRecognizer在 TextRecognizer 中设置 OCR 白名单
【发布时间】:2016-12-28 17:55:39
【问题描述】:

我正在分析 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 培训文件

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

感谢您的帮助!

【问题讨论】:

    标签: android-vision


    【解决方案1】:

    我也在努力,我正在尝试制作具有移动视觉的名片阅读器,到目前为止,当检测到文本时,我正在使用实时生成的字符串检查 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% 的准确率打印日志,也许我们可以互相帮助,而且我希望这些正确的日志显示在我使用过界面但它不起作用的活动中。 如果您有任何发现的提示或技巧,请分享。

    【讨论】:

      猜你喜欢
      • 2011-09-19
      • 1970-01-01
      • 2017-09-28
      • 2012-10-22
      • 2022-06-26
      • 2018-01-19
      • 2020-04-14
      • 2017-09-14
      • 1970-01-01
      相关资源
      最近更新 更多