简体   繁体   English

tesseract / tesjeract在实例化时使应用程序崩溃

[英]tesseract/tesjeract crashes application upon instantiation

I'd like to use tesseract in Java as I need to perform OCR for my ImageJ plugins. 我想在Java中使用tesseract,因为我需要为ImageJ插件执行OCR。 Therefore I am using the Java wrapper "tesjeract". 因此,我正在使用Java包装程序“ tesjeract”。 However, when I instantiate new Tesjeract("eng") ImageJ crashes without giving any information. 但是,当我实例化new Tesjeract("eng") ImageJ崩溃而没有提供任何信息。

Loading the libraries seems to be working, because when I don't instantiate new Tesjeract("eng") and run the same plugin twice, the second time I receive an UnsatisfiedLinkError: Native library C:\\Windows\\System32\\tessdll.dll already loaded in another classloader . 加载库似乎正在工作,因为当我不实例化new Tesjeract("eng")并运行两次相同的插件时,第二次我收到UnsatisfiedLinkError: Native library C:\\Windows\\System32\\tessdll.dll already loaded in another classloader

Any ideas, what I can do to solve the problem? 有什么想法,我该怎么做才能解决问题?

In case it is relevant, I'm using Windows 7 64-bit, but have configured ImageJ to use 32-bit JVM, since tesseract is only available as 32-bit dll. 如果相关,我使用的是Windows 7 64位,但已将ImageJ配置为使用32位JVM,因为tesseract仅作为32位dll提供。 I'm loading the dlls in a static block and both of them are placed in C:\\Windows\\System32 folder. 我将dll加载到静态块中,并且它们都放在C:\\ Windows \\ System32文件夹中。

static
{
    System.loadLibrary("tessdll");
    System.loadLibrary("tesjeract");
}

Edit: 编辑:

If found out that someone was experiencing a similar problem in c++, and the solution was that the languange files were missing. 如果发现有人在c ++中遇到类似的问题,并且解决方案是缺少languange文件。 I suppose that's the problem in my case as well. 我想这也是我的问题。

This is how the directory should look like ( found here ): 这是目录的外观(在此处找到):

project.exe
tessdll.dll
tessdata ----- eng.DangAmbigs
            |- eng.freq-dawg
            |- eng.inttemp
            |- eng.normproto
            |- eng.pffmtable
            |- eng.unicharset
            |- eng.user-words
             - eng.word-dawg 

ImageJ is configured to use C:\\Program Files(x86)\\Java\\jre7\\bin\\javaw.exe . ImageJ配置为使用C:\\Program Files(x86)\\Java\\jre7\\bin\\javaw.exe So I placed my dlls including the tessdata folder in the same directory and deleted the dlls from System32. 因此,我将包括tessdata文件夹的dll放在了同一目录中,并从System32中删除了这些dll。 Still, the application crashes. 尽管如此,应用程序仍然崩溃。

*.traineddata is language data for tess 3.x. * .traineddata是tess 3.x的语言数据。 You'll need ones for 2.x, such as tesseract-2.00.eng.tar.gz . 您需要2.x版的,例如tesseract-2.00.eng.tar.gz

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM