【问题标题】:Issue met when using Tess4j使用 Tess4j 时遇到的问题
【发布时间】:2017-09-05 19:52:07
【问题描述】:

我正在尝试使用 TessBaseAPICreate() 创建 TessBaseAPI,但遇到如下错误:

java.lang.UnsatisfiedLinkError: Error looking up function 'TessPDFRendererCreateTextonly': dlsym(0x7fc93f349590, TessPDFRendererCreateTextonly): symbol not found
    at com.sun.jna.Function.<init>(Function.java:212)
    at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:541)
    at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:518)
    at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:504)
    at com.sun.jna.Native.register(Native.java:1655)
    at com.sun.jna.Native.register(Native.java:1529)
    at com.sun.jna.Native.register(Native.java:1252)
    at net.sourceforge.tess4j.TessAPI1.<clinit>(TessAPI1.java:41)
    at com.mail.service.Tess4jServiceImpl.<init>(Tess4jServiceImpl.java:23)

我的代码如下

public class Tess4jServiceImpl {
    private String imageFilePath;
    private TessAPI1.TessBaseAPI tessBaseAPI;
    private static String tessDataPath = "***/tessdata/";
    public Tess4jServiceImpl(String imageFilePath){
        this.imageFilePath = imageFilePath;
        tessBaseAPI = TessAPI1.TessBaseAPICreate();
    }

我在 net.sourceforge.tess4j 的依赖项中排除了 com.sun.jna 并添加了新的 jna 依赖项为

<dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
            <version>4.2.1</version>
        </dependency>

对于这个问题,我有什么特别需要注意的吗? 谢谢。

【问题讨论】:

  • tesseract 版本是 4.0,tess4j 是 3.4.0。

标签: tess4j


【解决方案1】:

我在 Ubuntu 16.4 LTS 上的 tesseract 4.0 版(从源代码编译)和 tess4j 3.4.0 版遇到了同样的问题。由于找不到任何解决方案,我已经卸载了 tesseract 版本 4 并从 Ubuntu 存储库安装了 3.04 版本。我将pom.xml中的tess4j版本改成3.0.0,问题就解决了。

我猜,3.4.0 版的 tess4j 与 tesserct 4 版不兼容,毕竟还是 alpha 版。

我希望这会有所帮助。

【讨论】:

  • 是的,这是兼容性问题。我为 tess4j 4.0.0-snapshot 添加了 maven 依赖项。现在可以使用了。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-02-21
  • 2021-11-08
  • 2014-01-08
  • 2011-03-09
  • 2013-01-30
  • 2016-11-13
  • 2016-07-21
相关资源
最近更新 更多