← Back to team overview

sikuli-driver team mailing list archive

[Question #690346]: Find gives different result when using Pattern attributes on code than using the IDE pane

 

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

I have some images that are of different size than the ones on screen, so I made a script to find which resize and similarity parameters best ressemble what its displayed.
What I got is that the script gets a match on every size and similiarity value, however the Pattern preview pane on the IDE works as intended and matches with similarity values of 0.88 and less (though it doesn't seem to use the resize value).
It's not clear to me if I'm doing something wrong so I leave the short script here so you can look at it and find if there is any way to make it work with SikuliX.
***
import csv

raw = []
laps = 5
relevant_area = Region(150,585,55,55)
fieldnames = ['SIZE', 'PRECISION', 'AVG_SCORE', 'COUNT']
with open('O:\\Intercambio\\Captain Tsubasa\\best_pattern_modifiers_output.csv', mode='wb') as csv_file:
    output_writer = csv.writer(csv_file, dialect='excel', delimiter=';')
    output_writer.writerow(fieldnames)
    for precision in range(51, 101):
        for size in range(50,101, 10):
            for lap in range(laps):
                found_match = relevant_area.exists(Pattern("icon_selection_small_left_t_s.png").resize(round(size / 100, 1)).similar(precision / 100).mask(), 0)
                if found_match:
                    raw.append(found_match.getScore())
            n = len(raw)
            if n >= (int(round(laps / 2)) + 1):
                avg = round(sum(raw) / n, 2)
                output_writer.writerow((size, precision, avg, n))
            raw = []


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