Tesseract遇到致命错误!” == NULL:错误:声明失败:在文件globaloc.cpp中,第75行

时间:2020-08-28 12:52:26

标签: java tesseract

1-我在git Hub https://github.com/tesseract-ocr/tessdata上下载了tesdata

2-提取文件夹并将路径传递到Tesseract类

3-运行应用程序时,显示以下错误

提取文件夹并将路径传递到Tesseract类

运行应用程序时,显示以下错误

已执行代码段

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下载后,您还需要进行其他配置吗?

2 个答案:

答案 0 :(得分:0)

您可能使用了不兼容的语言数据。对于当前的Tesseract版本,请使用Linux发行版随附的tessdata_besttessdata_fast。 (您可以通过检查文件大小来进行验证。)

https://github.com/tesseract-ocr

答案 1 :(得分:0)

  1. 确保您仅安装了一个版本的tesseract
  2. 首先检查您使用过的tesseract版本(已安装)。使用最新版本(4.x或5 alpha)
  3. 使用tesseract可执行文件而不是包装程序测试OCR-它可以提供更多信息来查找问题。