[1.1.4] Windows 10: Trying OCR: getting UnsatisfiedLink-Error

Asked by Chris Kosieracki

++++++++++++++++++ possible solution
--------------------------------------------------------------------------------------------------------

On your system the latest Vision C++ Redistributable might be missing.
see: https://support.microsoft.com/de-de/help/2977003/the-latest-supported-visual-c-downloads

--------------------------------------------------------------------------------------------------------

1.1.4-SNAPSHOT-#393-2019-10-10_16:07/Windows10.0/Java8(64)1.8.0_221-b11

Installed build 393 this morning on Windows 10. When attempting txt = reg.text() the first time was sent to https://github.com/RaiMan/SikuliX1/wiki/macOS-Linux:-Support-libraries-for-Tess4J-Tesseract-4-OCR which addresses Mac and Linux, but not Windows.

Guessing what to do, I download and installed tesseract. Running tesseract -v gives me: tesseract v4.0.0.20190314
 leptonica-1.78.0
  libgif 5.1.4 : libjpeg 8d (libjpeg-turbo 1.5.3) : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11 : libwebp 0.6.1 : libopenjp2 2.2.0
 Found SSE

What else do I need to do?
Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Chris Kosieracki
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Tried on my Windows 10: works as expected.

For Windows, the needed libraries are bundled and exported from the package ready to use.
Hence no need to install Tesseract (4.1.0 needed anyways).

run SikuliX from commandline so:
java -jar <path-to>\sikuli.jar -v -c

repeat your test in the IDE and watch the debug output on commandline.

It looks like some basic library support is missing on your system (VC++Runtime ??)

Revision history for this message
Chris Kosieracki (cckozie) said :
#2

I don't see any errors other than not finding Tesseract library. I tried it on two different Windows 10 machines.

[debug] RunTime:checkJavaUsrPath: added to ClassLoader.usrPaths
[debug] RunTime:libsExport: folder exists: C:\Users\tsqa1\AppData\Roaming\Sikulix\SikulixLibs (1.1.4 - 201910101607)
[debug] RunTime:loadLib: opencv_java342.dll (success)
[debug] TextRecognizer: start: Tess4J 4.4.0 using Tesseract 4.1.0
[error] TextRecognizer: start: Tesseract library not found (libtesseract.so)
[error] Save your work, correct the problem and restart the IDE!
[error] see: https://github.com/RaiMan/SikuliX1/wiki/macOS-Linux:-Support-libraries-for-Tess4J-Tesseract-4-OCR
[error] script [ iTest ] stopped with error in line 5
[error] org.sikuli.script.SikuliXception ( org.sikuli.script.SikuliXception: fatal: TextRecognizer could not be initialized )
[error] --- Traceback --- error source first
line: module ( function ) statement
5: main ( <module> ) txt = reg.text()
[error] --- Traceback --- end --------------
[debug] RunTime:***** running cleanUp *****

Revision history for this message
RaiMan (raimund-hocke) said :
#3

--- [error] TextRecognizer: start: Tesseract library not found (libtesseract.so)
I am sorry, but the above message is misleading, I have to fix that. Since the library libtesseract for Windows is bundled with sikulix.jar (and hence is always found), I did not forsee, that there might be problems on Windows.

In fact this message is produced, when during start of Tesseract, the loading of the library produces an UnsatisfiedLink-Error.

So definitely on your system(s) there is something missing, that is needed at runtime by the libtesseract. This usually are some system libraries like the mentioned VC++ runtime or some media libraries (special edition of Windows).

Please try with google to find out, in what cases libraries prebuilt with VC++ might raise UnsatisfiedLink-Errors.

I will revise the error handling to print out in case, what is available and add respective information to the wiki-page.
So feedback in case you find out anything is highly appreciated.

Revision history for this message
Chris Kosieracki (cckozie) said :
#4

My bad. I didn't have the VC++ runtime installed. (Didn't know it was a prerequisite)
Downloaded the latest and both reg.text() and reg.findText() now work correctly.
Thanks!

Revision history for this message
RaiMan (raimund-hocke) said :
#5

Thanks for feedback. I will add this to the docs.