我正在使用tess4j(4.3.1版),以便可以将图像文件转换为文本文件以为Lucene准备索引。它可以工作,但最后会发出警告
Warning: Parameter not found: enable_new_segsearch
这是我的pom.xml
<dependencies>
<dependency>
<groupId>org.ghost4j</groupId>
<artifactId>ghost4j</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.3.1</version>
</dependency>
<dependency>
<groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-core</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>net.sourceforge.lept4j</groupId>
<artifactId>lept4j</artifactId>
<version>1.12.0</version>
</dependency>
</dependencies>
还有我的Java主类:
File imageFile = new File("samples/eurotext.pdf");
ITesseract instance = new Tesseract();
instance.setDatapath("E:\\tessdata");
try {
String result = instance.doOCR(imageFile);
System.out.println(result);
} catch (TesseractException e) {
System.err.println(e.getMessage());
}
使用以下VM参数:
-Djna.library.path=${workspace_loc:/ocr-tess4j-example}/dlls/x64
dlls / x64文件夹的内容:
如何摆脱警告消息?
答案 0 :(得分:0)
尝试:
instance.setTessVariable("debug_file", "/dev/null");
答案 1 :(得分:0)
语言数据不正确。从[https://github.com/tesseract-ocr/tessdata]下载了整个tessdata。错误消失了。从这里得到了这个主意 https://pdfc.inetsoftware.de/public/help/tesseract4/p/optical-character-recognition