Gradually reducing MinSimilarity

Asked by Max Musterman on 2019-02-03

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:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2019-02-03
Last query:
2019-02-03
Last reply:
2019-02-03
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

Max Musterman (zegg) said : #2

Thanks a bunch