← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #221171]: How to use OCR(optical character recognition) in python?

 

Question #221171 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/221171

    Status: Open => Answered

RaiMan proposed the following answer:
Sikuli Script (and hence the Sikuli IDE) uses Python language (level
2.5), but the interpreter used is Jython 2.5 (which comes bundled with
Sikuli). Jython is Java based and so all Python-only modules should
work, which means, that Python modules (like PIL) containing C-based
stuff cannot be used. On the other side, everything available in the
Java world can be imported and used.

at 1>
import shutil
img = capture(some_region)
shutil.move(img, "to_other_place_you_need_name.png")

at 2>
If you have a solution, that only works in Python (aka needs C-Python interpreter), you might do that.
Sikuli has an OCR feature based on Tesseract 2, that might deliver sufficient results:

text = some_region.text()

but mind bug 710586

at 3>
do it in- or outside Sikuli

at 4>
Sikuli can search for text with the same restrictions as for >2

some_region.find(some_token_text)

and of course
click(some_token_text)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.