【发布时间】: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