简体   繁体   中英

tesseract/tesjeract crashes application upon instantiation

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.

*.traineddata is language data for tess 3.x. You'll need ones for 2.x, such as tesseract-2.00.eng.tar.gz .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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