New question #690849 on Sikuli:
https://answers.launchpad.net/sikuli/+question/690849

Hi! I am new with Sikuli and Tesseract OCR; I like to recognise text using 
Sikuli OCR and Jython as
'strLast = OCR.readWord(regLastFallenNumber)', or 
'strLast = regLastFallenNumber.text()'

I am running  Sikuli 2.0.4-2020-03-14_08:01 / WINDOWS 6.1 (=Win7) 64bit / java 
version "1.8.0_251"; Sikuli automation works.

It fails with this for the OCR class call:
"...
) raised: Traceback (most recent call last):
  File "<string>", line 14, in <module>
        at 
org.sikuli.script.TextRecognizer.getTesseractAPI(TextRecognizer.java:83)
        at org.sikuli.script.TextRecognizer.doRead(TextRecognizer.java:350)
        at org.sikuli.script.TextRecognizer.readText(TextRecognizer.java:309)
        at org.sikuli.script.OCR.readText(OCR.java:691)
        at org.sikuli.script.OCR.readWord(OCR.java:773)
        at org.sikuli.script.OCR.readWord(OCR
.java:760)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: Could not 
initialize class net.sourceforge.tess4j.Tesseract1"

So, I researched int internet and found about Tesseract that it "Windows: Works 
out of the box". So, why then the above message? 

By the way, here the Jython I was using in the Sikuli IDE - also not sure that 
I am not mixing up concepts there...
    # OCR configuration
    import org.sikuli.script.TextRecognizer as STR        # switch on the OCR 
feature
    OCR.reset()
    optMySet = OCR.Options()
    optMySet.oem(3)
    optMySet.psm(8)
    optMySet.asWord()
    optMySet.language("eng")
    #optMySet.smallFont()
    optMySet.variable("user_defined_dpi", "112")
    STR.reset()
    #print optMySet

    Settings.OcrTextRead = True
    
    regLastFallenNumber = Region(425,292,48,21)
    regLastFallenNumber.highlight(1)
    strLast = OCR.readWord(regLastFallenNumber)
    #strLast = regLastFallenNumber.text()
    print strLast

Thanks a lot for your help :)

Simon




-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to