← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #418151]: How to define a non-fixed region for OCR? (Sikuli IDE)

 

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

    Status: Open => Answered

Roman Podolyan proposed the following answer:
@Milteven. 
I see two areas which can be used as "guides". 
The first is small phrase "Ativo e lucro". It looks like its relative position to the percentage you need is stable. 
The second is bigger text starting "O lucro que". 

So what you want to do:

1) Find something by image which is on stable position against region you are interested in, read it to match object. 
2) From coordinates of that match object construct a new region.
3) Do some testing to mare sure that the area you are interested is really that region.
4) Use it. 

Here is a sample of code doing that using "Ativo e lucro":
______
#here goes "Ativo e lucro" image with similarity increased to 85 
match = find("1483189609482.png")      
# using obtained match we do construct new region, adding desired width and height and offsets. 
newregion = Region(match.getX()+ 45, match.getY()+ 65 , 40, 20)
# this is a  test code, it makes constructed region "blink" 4 times
for i in range(4):
    newregion.highlight(1)
______

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