OCR Useage

Asked by Jeff_Vallis on 2020-04-04

How do I use OCR have found no Examples
So I tried
setRect(349,252,117,16)
highlight(1)
v = text()
print v

Result
[error] java.lang.NoClassDefFoundError ( java.lang.NoClassDefFoundError: Could not initialize class net.sourceforge.tess4j.Tesseract1 )

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
Jeff_Vallis
Solved:
2020-04-06
Last query:
2020-04-06
Last reply:
2020-04-05
Jeff_Vallis (vallis-pj) said : #1

Forgot again :-
2.0.1-2019-11-22_16:54/Mac10.15.3/Java13(64)13.0.1+9

RaiMan (raimund-hocke) said : #2

please try with latest 2.0.4

jerome (jerome2-gill) said : #3

I have 2.0.4 and simply installing the packages tesseract-ocr libtesseract-dev continues to result in a NoClassDef error.
Can we at least get some documentation on this please?

Jeff_Vallis (vallis-pj) said : #4

Downloaded and 2.0.4

now
2.0.4-2020-03-14_08:01/Mac10.15.3/Java13(64)13.0.1+9

ran
setRect(349,252,117,16)
highlight(1)
v = text()
print v

Result -
Web page Loaded
https://github.com/RaiMan/SikuliX1/wiki/macOS-Linux:-Support-libraries-for-Tess4J-Tesseract-4-OCR

Followed Instruction :-
brew install tesseract
tesseract -v
Result :-
tesseract 4.1.1
 leptonica-1.79.0
  libgif 5.2.1 : libjpeg 9d : libpng 1.6.37 : libtiff 4.1.0 : zlib 1.2.11 : libwebp 1.1.0 : libopenjp2 2.3.1
 Found AVX2
 Found AVX
 Found FMA
 Found SSE

Ran again :
with regions on the Web Page Loaded
x1 = Region(562,529,117,17)
setRect(x1.x,x1.y,x1.w,x1.h)
highlight(1)
v = text()
print "^ " * 40
print v
print "^ " * 40
x1 = Region(171,616,649,22)
setRect(x1.x,x1.y,x1.w,x1.h)
highlight(1)
v = text()
print "^ " * 40
print v
print "^ " * 40
exit(0)

Result :-

[log] highlight R[562,529 117x17]@S(0) for 1.0 secs
[log] highlight R[171,616 649x22]@S(0) for 1.0 secs
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
libtiff 4.0.10
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
This might work as well with other package managers like MacPorts, Finch, ..., but is not tested.
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
[info] Exit code: 0

So without testing my actual code it appears to be ok.