How to extract text from an image on xRC2

Asked by Silverallis

Its a great achievement that RC versions has OCR capabilities.

I am trying to extract text from an Image and I need help.

If anybody can post a sample code. That will help me a lot.

Thanks for your time.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Silverallis
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

here you are:

put exactly this web page on the screen and try to run the following script:

r = selectRegion("capture the top of the page")
# when the prompt comes, capture the upper part of the page with the logo to the Answer menu

r.highlight(2) # highlights what you captured

r.below(30).highlight(2) # should frame the topic text
print r.below(30).text() # should read the topic and print it, adjust the 30 if needed

r.below(300).highlight(2)
m = r.below(300).find("Information")
m.highlight(2)

Hope that is enough for a first impression and motivates you to make your own experiments.

Revision history for this message
Silverallis (silverallis) said :
#2

Thanks a lot Raiman. Your are quick in responding. Appreciate !!!

How can I define a region and then extract text. eg:

rr = Region ( 10,20,30,40)
print rr.text()

Please correct my code.

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

yes, like this.

you should really look through the docs and examples, to find out the basics.

... and make your own experiments. really - it is fun.

Revision history for this message
Silverallis (silverallis) said :
#4

Sure RaiMan, I understand. Thanks a lot for your help :)