Text Search and OCR / Sikuli's Text Recognition

Asked by tanya25

Good Day!

How do i use Sikuli's Text Recognition in jython? I already downloaded the latest version of sikuli 1.1.0 2015-09-03_01:00nightly IDE with the selected Tesseract based OCR features on my window's machine

in addition, what are the advantages and disadvantages of Sikuli's Text Recognition?

Thank You :)

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Eugene S (shragovich) said :
#1

Hi,

You can use text recognition like that:

Settings.OcrTextRead = true;
Region sc = new Screen(0);
sc.findText("text").highlight(1);

Text recognition doesn't always work as expected. In many cases the text will not be recognized.
To see what is exactly recognized on your current screen, you can try to read the whole screen and check whether the text you are trying to find was detected:

Region sc = new Screen(0);
System.out.println(sc.text());

It is possible to fine tune the Tesseract to better recognize your specific font. You can try and Google it.

Revision history for this message
RaiMan (raimund-hocke) said :
#2

Since she talks about Jython:

Settings.OcrTextRead = True

When running scripts in the IDE only, one can also set in the preferences -> more options the respective options.

Revision history for this message
tanya25 (regina-tanya) said :
#3

Thank You Eugene and RaiMan

I am running my scripts on IDE only. I have this line of code which works:

findText("text name")

However, how do I click the text on my screen without using a screenshot?

In your opinion what are the advantages and disadvantages of sikuli's text recognition

Revision history for this message
RaiMan (raimund-hocke) said :
#5

click(findText("text name"))

since findText("text name") returns the match region where the text was found.

-- advantage
internally uses Tesseract ;-)

-- disadvantage
still a very poor and restricted implementation.

-- conclusion
- fine if it works with your fonts and language
- bad if it does not work (but some chances to make it work - see Eugene's tip)

Revision history for this message
tanya25 (regina-tanya) said :
#6

Thanks a lot Raimund :)

Can you help with this problem?

Provide an answer of your own, or ask tanya25 for more information if necessary.

To post a message you must log in.