Gradually reducing MinSimilarity

Asked by Max Musterman

Hi, thanks for your work maintaining this script. I wonder, is there a way to gradually reduce the MinSimilarity? You can set it to a specific value, but is it possible to reduce it by 0,01 continuously within a loop until it finds an image? Something like

Settings.MinSimilarity=1
loop
    if image exists
        do thing
        break
    else
        decrease MinSimilarity by 0,01

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

in the IDE itself you can check the similarity score:
- click on the image
- in the window coming up in the tab matching preview play around with the slider at the bottom

your script trial would look like:

simValue = 1
while True:
    if not exists(Pattern(image).similar(simValue), 0): # see comment
       simValue -= 0.01
       continue
    # do something when found
    break

Revision history for this message
Max Musterman (zegg) said :
#2

Thanks a bunch