tesseract/tesjeract 在实例化时导致应用程序崩溃
我想在 Java 中使用 tesseract,因为我需要为我的 ImageJ 插件执行 OCR。因此我使用 Java 包装器“tesjeract”。但是,当我实例化 new Tesjeract("eng")
ImageJ 崩溃时没有提供任何信息。
加载库似乎有效,因为当我不实例化 new Tesjeract("eng")
并运行同一插件两次时,第二次我收到 UnsatisfiedLinkError: Native library C :\Windows\System32\tessdll.dll 已在另一个类加载器中加载
。
有什么想法,我能做些什么来解决这个问题吗?
如果相关的话,我使用的是 Windows 7 64 位,但已将 ImageJ 配置为使用 32 位 JVM,因为 tesseract 仅作为 32 位 dll 提供。我正在静态块中加载 dll,它们都放置在 C:\Windows\System32 文件夹中。
static
{
System.loadLibrary("tessdll");
System.loadLibrary("tesjeract");
}
编辑:
如果发现有人在 c++ 中遇到类似的问题,并且解决方案是语言文件丢失。我想这也是我的情况的问题。
这就是目录的样子(找到 此处):
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 配置为使用 C:\Program Files(x86)\Java\jre7\bin\javaw.exe。因此,我将包括 tessdata 文件夹在内的 dll 放在同一目录中,并从 System32 中删除了 dll。尽管如此,应用程序还是崩溃了。
I'd like to use tesseract in Java as I need to perform OCR for my ImageJ plugins. Therefore I am using the Java wrapper "tesjeract". However, when I instantiate new Tesjeract("eng")
ImageJ crashes without giving any information.
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
.
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. I'm loading the dlls in a static block and both of them are placed in C:\Windows\System32 folder.
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. 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
. So I placed my dlls including the tessdata folder in the same directory and deleted the dlls from System32. Still, the application crashes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
*.traineddata 是 tess 3.x 的语言数据。您需要 2.x 版本的文件,例如 tesseract-2.00.eng.tar .gz 。
*.traineddata is language data for tess 3.x. You'll need ones for 2.x, such as tesseract-2.00.eng.tar.gz .