Error looking up function 'TessPDFRendererCreateTextonly'

Asked by Pedro García on 2018-12-10

Hi, I need to capture text (using Tesseract OCR) from a region of the terminal window of my Oracle VM Vbox.

 I'm using Eclipse in Ubuntu 18.04 and have:
 - installed opencv (with cmake -D BUILD_SHARED_LIBS=ON .. & make -j4) and tesseract (with sudo apt-get install tesseract),
 - linked libtesseract.so to /usr/lib.
 - set LD_LIBRARY_PATH environment variable to the path where libtesseract.so is.
 - Included the latest sikulixapi.jar in my Eclipse Project (and every sikulix command is working except the OCR part)

To solve the error I've tried (as recommended in https://stackoverflow.com/questions/46030022/issue-met-when-using-tess4j ): "uninstalled tesseract version 4 and installed the version 3.04 from the Ubuntu repositories. I changed the tess4j version in my pom.xml to 3.0.0",
 but still get the same error.

Here is the line of my script that produces the error (second line):
region = new Region(273, 129, 73, 250);
String sikuliText = region.text();

Error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'TessPDFRendererCreateTextonly': /usr/lib/libtesseract.so: undefined symbol: TessPDFRendererCreateTextonly
 at com.sun.jna.Function.<init>(Function.java:245)
 at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:566)
 at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:542)
 at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:528)
 at com.sun.jna.Native.register(Native.java:1777)
 at com.sun.jna.Native.register(Native.java:1648)
 at com.sun.jna.Native.register(Native.java:1360)
 at net.sourceforge.tess4j.TessAPI1.<clinit>(TessAPI1.java:41)
 at org.sikuli.script.TextRecognizer.start(TextRecognizer.java:56)
 at org.sikuli.script.TextRecognizer.doOCR(TextRecognizer.java:195)
 at org.sikuli.script.TextRecognizer.doOCR(TextRecognizer.java:190)
 at org.sikuli.script.Region.text(Region.java:4840)
 at TMSconOCR.getTextByOCR(TMSconOCR.java:380)
 at TMSconOCR.main(TMSconOCR.java:237)

Am I missing something?

Thanks a lot,

Pedro.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2018-12-11
Last query:
2018-12-11
Last reply:
2018-12-10
Best RaiMan (raimund-hocke) said : #1

If it is SikuliX 1.1.4 you should follow the steps:
https://sikulix-2014.readthedocs.io/en/latest/newslinux.html (except the Java 11 hint: Java 11 is available now)

If not, the I recommend to switch to 1.1.4, which already includes the Tess4J classes.

I've followed the instructions and it´s working perfectly!!
Thank you very much.