目标是从图像中读取数字特定数据 (1,2,...,9,0)。 为此,我使用 Tess4j 版本 4.1.1。
<!-- https://mvnrepository.com/artifact/net.sourceforge.tess4j/tess4j -->
<dependency>
<groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId>
<version>4.1.1</version>
</dependency>
我的示例代码如下所示:
ImageIO.read(new File("c:\\temp\\number1.jpg"));
ITesseract instance = new Tesseract();
instance.doOCR(img);
但由于某种原因,它会将某些数字误识别为字母。因此,为了最大限度地减少错误,我只需要将数字列入白名单。
因为这在早期的 Tess4j 版本(3.0.**)中是可能的,TessBaseAPI ,但在当前的 4.1.* 版本中它不可用。 有人可以帮我解决一下如何在 TessAPI 4.1.* 及更高版本中设置白名单字符吗?
最佳答案
自 Tesseract 4.00-alpha 以来,该功能已被破坏。目前尚未修复。
关于java - 如何将 tess4j 版本 4.1.* 中的字符列入白名单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51697615/