sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #08519
Re: [Question #186486]: How to create an auto correcting find function?
Question #186486 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/186486
Status: Open => Answered
RaiMan proposed the following answer:
I have problems to think about situations where this could help
something.
The basics can be checked using the Preview feature in the IDE.
If you have good shots (little background, the distinguishing part of
the image covers more than 70-80% of the image area) the average match
similarity is above 0.9 and even 0.95. Many (felt: most) of my matches
have a score of 1.0.
So to check, wether you have a "good" or a "critical" image, you have to
do it the other way round, and you have to restrict the search to the
region, where you expect the image to be (a missing feature in the
Preview).
reg = <some evaluated or given search region>
img = "some-image.png"
sim = 0.99
found = False
while not found:
if reg.exists((Pattern(img).similar(sim),0):
found = True
break
if sim < 0.8: break
sim -= 0.2
if found:
m = reg.getLastMatch()
m.highlight(2)
print "found", m
else: print "not found"
The lower the similarity the greater the risk, you found something
wrong. Without being able to prove it, only a "feeling": scores below
0.8 - 0.85 are very risky especially in large regions. This tells you,
that your shot might be suboptimal. Or needs additional checks for being
the right one.
I think, this would really help:
In the Preview you can restrict the search region and adjust the image boundaries to an optimal shape. This goes together with the request for images with transparent background, that are ignored when searched.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.