pattern matching best practice?

Asked by shaihulud

How do I adjust the similarity of the screenshot (pattern) and the actual screen to get the most stable tests? When I adjust the slider for similarity the target image that will be used turns red and other possible targets on the screen turns pink. Should I adjust the slider so I cannot see any pink at all? or is it demanding to much at 0,99 as much as possible?
For example, i have a pattern which finds the right target at 0,99 At 0,50 the other pink targets start to appear. Where would you put the similarity at?

Question information

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

"good shots" are always matched with a score of >0.95 mostly with 1.0 (= exact match which means >0.99 according to the internally done rounding).

what are good shots?
1. as little background as possible (the more uniform background the lower the score - a good shot brings 1.0, but leaving too much background around might lower it down to a score being 0.1 lower)
2. concentrating on the key visual aspects (people tend to cut generously around the target image, but this leads to the effects of 1. - so it is better to cut more inside the target image preserving distinguishing elements - example button: usually people cut generously around the button - better: cut in a way, that only the left and top border including the button text is captured, which is just concentrating on distinguishing key visual aspects)

So if you have good shots, normally there is no need, to deal with the similarity at all.

Only in situations, where your target might not be visible and you have the risk that something else might be found with a score >0.7, then you have to change the image to a pattern having a min similarity attached.

And you need it to distinguish different versions of the same image (e.g. enabled/disabled button) in the match region.

But even in the first mentioned situations it might not be necessary, if you are working with restricting regions as often as possible, which brings you more speed and less resource usage besides reliability.

On the list for enhancements this year is a better support for getting "good shots" and some learning feature based on the finding history.

Already now with version 1.1.0, an image, that was found before is first searched in the place where it was found before (if this place is within the given region) and only if it is no longer there it will be searched in the given region.
So for example: the first search on the whole screen takes 400 msecs and subsequent searches will take only around 10 msecs if the image is still in place.

Revision history for this message
shaihulud (cal-a) said :
#2

Thank you so much, this is great information!

Revision history for this message
shaihulud (cal-a) said :
#3

Thanks RaiMan, that solved my question.