问题描述
1-我在git Hub https://github.com/tesseract-ocr/tessdata上下载了tesdata
已执行代码段
public class TesseractOcrTest {
private final String tesseractPath = "/home/tessdata/";
@Test
public void shouldReturnTrueIfRunOcrEquals() throws Exception {
String result = new TesseractOcr(tesseractPath).runOcr("bw_HighResolution_en.jpeg").trim();
assertEquals(
"Optical Character Recognition in Java\nis made easy with the help of Tesseract",result);
}
}
Error: Illegal Parameter specification!
"Fatal error encountered!" == NULL:Error:Assert Failed:in file globaloc.cpp,line 75
#
# A Fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f52a582d69b,pid=8957,tid=8966
#
# JRE version: OpenJDK Runtime Environment (11.0.7+10) (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
# Java VM: OpenJDK 64-Bit Server VM (11.0.7+10-post-Ubuntu-2ubuntu218.04,mixed mode,sharing,tiered,compressed oops,g1 gc,linux-amd64)
# Problematic frame:
# C [libtesseract.so.4+0x25969b] ERRCODE::error(char const*,TessErrorLogCode,char const*,...) const+0x16b
注意:将路径从tesdata更改为OS安装路径(private final String tesseractPath = "/usr/share/tesseract-ocr/4.00/tessdata/";
)时,我可以完美地做到。如果我指向从git hub下载的tesdata,那就行不通了。
我在做什么错?从github下载后,您还需要进行其他配置吗?
解决方法
您可能使用了不兼容的语言数据。对于当前的Tesseract版本,请使用Linux发行版随附的tessdata_best
或tessdata_fast
。 (您可以通过检查文件大小来进行验证。)
https://github.com/tesseract-ocr
,- 确保您仅安装了一个版本的tesseract
- 首先检查您使用过的tesseract版本(已安装)。使用最新版本(4.x或5 alpha)
- 使用tesseract可执行文件而不是包装程序测试OCR-它可以提供更多信息来查找问题。