android - 如何从图像中提取特定文本
问题描述
从下图中,我想提取文本 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";
}
}
解决方案
推荐阅读
- hibernate - hibernate grails ordering改变了结果的数量
- model - 如何将 Pytorch 的 NLLLoss 与计数数据一起使用?
- c - 在C中为文本文件构建Merkle树,每次重复该过程,都会生成一个新的根哈希
- linux - 是否可以使用 wxWidgets 仅使用控制台而不使用 UI 来运行单元测试?
- ios - 具有白色背景的材料设计大纲文本字段
- python - 使用 REST API 问题将文件上传到 imgur.com
- javascript - 将 TypeScript 与 Jest 一起使用不会捕获语法错误
- r - networkD3 和 Shiny - 按节点数过滤
- mysql - 如何使用 MySQL 和 T-SQL 获得一对多的关系类型
- python - 在 Heroku 上使用 python discord bot 调用 C 二进制文件