如何在tess4j版本4.1。*中将字符列入白名单

时间:2018-08-05 19:32:40

标签: java ocr tesseract tess4j

目标是从图像中读取数字特定的数据(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);

但是由于某种原因,它误将某些数字识别为字母。因此,为了使错误最小化,我只需要将数字列入白名单。

因为这在带有TessBaseAPI的早期Tess4j版本(3.0。**)中是可能的,但是在当前的4.1。*版本中不可用。 有人可以在这里帮助我,如何在TessAPI 4.1。*及更高版本中设置白名单字符?

1 个答案:

答案 0 :(得分:0)

自Tesseract 4.00-alpha起,该功能已损坏。尚未修复。

https://github.com/tesseract-ocr/tesseract/issues/751

相关问题