[2.0.5] Linux: Tesseract Tess4J Dont Work

Asked by Oleg

Hello. I use SikulixIDE-2.0.5-lux.jar, jre1.8.0_401, java version 1.8.0_401, Java HotSpot(TM) 64 Bit Server VM (build 25.401-b10, mixed mode) on Linux. Tesseract installed. Tess4J downloaded but don't know how to install. My script is:

from sikuli import *
s = Image.create("picture.png")
print(s.text())

This does not work. Writes:
[error] java.lang.UnsupportedOperationException: The BROWSE action is not supported on the current platform!
Perhaps I did not link the Tess4J to the Sikuli. How to do it?
Help me please.

Question information

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

how to make Tesseract ready for Sikulix:
https://github.com/RaiMan/SikuliX1/wiki/macOS-Linux-‐-Support-libraries-for-Tess4J-Tesseract-4-OCR

No need for Tess4J - is in the package already.

In a main script
from sikuli import *
is not needed, only in subs.

s = Image.create("picture.png")
print(s.text())
is corrrect and works for me (tested on Windows)

Revision history for this message
Oleg (iizedii) said :
#2

Without
from sikuli import *
I get another error:
[error] java.lang.NoClassDefFoundError ( java.lang.NoClassDefFoundError: Could not initialize class net.sourceforge.tess4j.Tesseract1 )
[error] --- Traceback --- error source first
line: module ( function ) statement
3: main ( <module> ) print(s.text())

If I type tesseract -v :
tesseract 4.0.0
 leptonica-1.76.0
  libgif 5.1.4 : libjpeg 6b (libjpeg-turbo 1.5.2) : libpng 1.6.28 : libtiff 4.0.8 : zlib 1.2.8 : libwebp 0.5.2 : libopenjp2 2.1.2
 Found AVX2
 Found AVX
 Found SSE

Help

Revision history for this message
Oleg (iizedii) said :
#3

If programm started with option -v and i run one line "print(s.text())" then write:

[debug] SikuliIDEPopUpMenu: PopMenuAction.doRunLine
[debug] SikuliIDEPopUpMenu: doRunLine: 3
[debug] Jython: use as default region: R[0,0 1024x768]@S(0)
[debug] Image: BufferedImage: (1024, 768)
[debug] OCR: start: Tess4J 4.5.4 using Tesseract 4.1.x
[error] JythonRunner: runPython: (
print(s.text())
) raised: Traceback (most recent call last):
  File "<string>", line 1, in <module>
 at org.sikuli.script.TextRecognizer.getTesseractAPI(TextRecognizer.java:103)
 at org.sikuli.script.TextRecognizer.doRead(TextRecognizer.java:376)
 at org.sikuli.script.TextRecognizer.readText(TextRecognizer.java:335)
 at org.sikuli.script.OCR.readText(OCR.java:710)
 at org.sikuli.script.OCR.readText(OCR.java:695)
 at org.sikuli.script.Element.text(Element.java:150)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: Could not initialize class net.sourceforge.tess4j.Tesseract1

Why "using Tesseract 4.1.x."? Perhaps the problem in version of tesseract? Write [debug] OCR: start: Tess4J 4.5.4 using Tesseract 4.1.x. , but I have tesseract 4.0.0

Revision history for this message
Launchpad Janitor (janitor) said :
#4

This question was expired because it remained in the 'Open' state without activity for the last 15 days.