← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #706503]: Помогите написать скрипт

 

Question #706503 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/706503

    Status: Open => Answered

RaiMan proposed the following answer:
For your eye the images are the same, but for SikuliX they have
different size in pixels.

In such cases the find operation will not work as expected. 
For exact matches you have to know the scaling factor and could try with Pattern().resize().

To give you an impression, try with this script:

img = "img.png" # see comment
pimg = Pattern(img).similar(0.8)

f = findAll(pimg)
while f.hasNext():
    m = f.next()
    print m
    m.highlight(2)

--- comment
I used a shot of the complete top left image

the printout:
M[161,148 201x133]IN(0) %100,00 C(261,214) [438/437 msec]
M[533,716 201x133]IN(0) %95,00 C(633,782) [438/437 msec]
M[63,385 201x133]IN(0) %83,76 C(163,451) [438/437 msec]
M[526,420 201x133]IN(0) %80,07 C(626,486) [438/437 msec]

All 4 images are found but the other 3 with bad scores (to be taken as exact match a score must be >0.99).
Wether lower scores are acceptable depends on your intention and the quality of the shots.

You might play with the above snippet and make your experiences.

Another challenge with your example: Currently there is no feature to
select an image automatically, you always either need to use the mouse
or give the coordinates for a capture.

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