how to use sikulix's ocr in eclipse

Asked by wu on 2020-01-31

i want to use the sikuli ocr in eclipse by java , why not use tess4j because simple ocr have to use photo to execution but sikuli ocr can

choose region and no photo (maybe have and put in the temp),so i want to use sikuli ocr by java in eclipse。

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2020-02-07
Last query:
2020-02-07
Last reply:
2020-02-04

This question was reopened

  • 2020-02-04 by wu
RaiMan (raimund-hocke) said : #1

Just use the latest 2.0.2, where Text/OCR is completely revised (simplified on one hand and open for any Tesseract-tweaking on the other).

Read an overview:
https://sikulix-2014.readthedocs.io/en/latest/textandocr.html

javadocs about the new OCR features:
https://raiman.github.io/SikuliX1/javadocs/org/sikuli/script/OCR.html

The class OCR allows to read text from various SikuliX sources and to identify lines and words as matches/regions.

Come back, if you need to find text in a Region (since I am currently busy to revise/complete the docs).

But with some luck you might find what you need already in the current Region javadoc:
https://raiman.github.io/SikuliX1/javadocs/org/sikuli/script/Region.html

wu (chouhua) said : #2

Thanks RaiMan, that solved my question.

wu (chouhua) said : #3

 i have a new question how to set the oce language by java ?

RaiMan (raimund-hocke) said : #4
wu (chouhua) said : #5

i use your solution but have not change the languae。
any do i mistake?

my code:

OCR.Options o = new OCR.Options();
o.dataPath("C:\\Program Files (x86)\\Tesseract-OCR\\tessdata");
o.language("chi_tra");

Best RaiMan (raimund-hocke) said : #6
wu (chouhua) said : #7

Thanks RaiMan, that solved my question.