New question #694607 on Sikuli:
https://answers.launchpad.net/sikuli/+question/694607

Hello friends, using Sikulix 2.0.4 in Win7 - big trouble when running the 
script on a different system where the web app to automate is slightly scaled 
down. SCREEN.find() on the script patterns won't work anymore. So, I try 
at-runtime code to get the scaling factor for resizing of all the patterns to 
get find() to work, but SkuliX does not work as expected. Here the issue in 
'manual' code:

pat = Pattern("1608112684558.png")    # a 737x50 search pattern
pat.similar(0.1)    # to avoid any FindFaileds

[On the scaled-down environment...]

pat.resize(1)
mat = SCREEN.find(pat)
print(mat.getScore())   # gives 0.603262484074, OK

pat.resize(0.99)
mat = SCREEN.find(pat)
print(mat.getScore())   # gives 0.753167867661, OK

pat.resize(0.98)
mat = SCREEN.find(pat)
print(mat.getScore())   # gives exception below!
"...org.sikuli.script.SikuliXception: image to search (737, 50) is larger than 
image to search in (729, 49)"
-> Does not resize the pattern anymore but uses the previous resized pattern as 
search region!?

pat.resize(0.97) or pat.resize(1.0)
mat = SCREEN.find(pat)
print(mat.getScore())   # gives exactly same exception as before!
"...org.sikuli.script.SikuliXception: image to search (737, 50) is larger than 
image to search in (729, 49)"
-> Very same error details with all different resize values!

***Now closing and restarting the SikuliX IDE ceteris paribus:***
pat.resize(0.98)
mat = SCREEN.find(pat)
print(mat.getScore())   # gives 0.878550231457, OK
-> Now it works, but why?

pat.resize(0.97) or pat.resize(1.0)
mat = SCREEN.find(pat)
print(mat.getScore())   # gives exception again
"...org.sikuli.script.SikuliXception: image to search (737, 50) is larger than 
image to search in (722, 49)"
-> Again, SikuliX bitching around with me, and needs to get restarted which 
would be, btw, acceptable with my wife, though...

Is this a (known?) bug in SikuliX, or is my understanding of .resize() bad? For 
sure I don't understand the exception message "image to search (w, h) is larger 
than image to search in (w, h)" - just makes no sense, also because the search 
region is SCREEN which is not in there. Please anyone help - I cannot deliver 
my solution if it cannot determine the needed pattern resizing factor based on 
a reference pattern for scale-changed applications across different screen 
resolutions///

Best!
Simon

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to