【问题标题】:How to extract particular text from Image如何从图像中提取特定文本
【发布时间】:2018-11-15 09:02:42
【问题描述】:

从下图中,我想提取文本 Arzt-Nr (654321161) 下方的数字。
我使用过 OCR 阅读器,但它不是按顺序随机提取文本,因此很难添加逻辑以在“Arzt-Nr”下方提取 no。

我使用了以下代码,但文本不是按顺序排列的。
有什么方法可以实现吗?

 String text = "";
            for (int i = 0; i < detectedItems.size(); i++) {
                TextBlock item = detectedItems.valueAt(i);
                String detectedText = item.getValue();
                List<Line> lines = (List<Line>) item.getComponents();
                for (Line line : lines) {
                    List<Element> elements = (List<Element>) line.getComponents();
                    for (Element element : elements) {
                        String word = element.getValue();
                        text = text + " " + word;

                    }
                    text += "\n";
                }
            }

【问题讨论】:

    标签: android ocr google-vision


    【解决方案1】:

    尝试检查“Arzt-Nr”位置之后的单词的固定长度,同时尝试检查单词的模式。例如,如果您只需要数字 ecc...

    【讨论】:

      【解决方案2】:

      使用 tesseract 提取图像的 tsv 输出,并在关键字位置下方找到最近的文本。也可以看看 tesseract 的分页模式。

      链接到Generating tsv 链接使用page segmentation

      【讨论】:

        猜你喜欢
        • 2019-06-30
        • 2020-06-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-01-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多