Find gives different result when using Pattern attributes on code than using the IDE pane
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.
Ninja edit: I'm using SikuliX 2.04 IDE on a VM with Win 7 Pro 64bits
***
import csv
raw = []
laps = 5
relevant_area = Region(
fieldnames = ['SIZE', 'PRECISION', 'AVG_SCORE', 'COUNT']
with open('O:
output_writer = csv.writer(
output_
for precision in range(51, 101):
for size in range(50,101, 10):
for lap in range(laps):
if found_match:
n = len(raw)
if n >= (int(round(laps / 2)) + 1):
avg = round(sum(raw) / n, 2)
raw = []
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Sikuli Edit question
- Assignee:
- No assignee Edit question
- Last query:
- 2020-04-30
- Last reply:
- 2020-04-30
RaiMan (raimund-hocke) said : | #1 |
I do not understand the inner loop (range(laps)), which simply does 5 times the same exists()?
What is the intention to use Pattern(
If only the size of the image varies, then a repeated exists() would be sufficient with the image resized with a stepping of 1 pixel between a min-size and a max-size should reveal a match with the best score.
Hence you have to calculate the resize factor out of the width or height.
Can you help with this problem?
Provide an answer of your own, or ask unomartin for more information if necessary.