[1.1.4]Is the masked pattern valid for findAll()?

Asked by masuo on 2018-08-26

code1: worked
code2: FindFailed exception occurred

[code1:]
maskImg = Pattern("cone-mask.png").asMask()
maskedPtn = Pattern("safety-cone.png").withMask(maskImg)
find(maskedPtn).highlight(1,"green")

[code2:]
maskImg = Pattern("cone-mask.png").asMask()
maskedPtn = Pattern("safety-cone.png").withMask(maskImg)
res = findAll(maskedPtn)
while True:
    if res.hasNext():
        m = res.next()
        m.highlight(1,"blue")
    else:
        break

https://photos.app.goo.gl/zj9JQLE8dfi9Wr9w8

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2018-08-29
Last query:
2018-08-29
Last reply:
2018-08-29
RaiMan (raimund-hocke) said : #1

LOL, you are my best tester ;-)

right, findAll with mask patterna does not yet work.

I make it a bug, since I found additionally, that the mask handling can be a bit easier.
So it takes a bit more time.

Thanks a lot.

masuo (masuo-ohara) said : #2

Thanks RaiMan, that solved my question.

masuo (masuo-ohara) said : #3

Evidence of executing the script
https://photos.app.goo.gl/GWdQLLnfFbRpwEfB6

The result of code 4 is not what I expected.

RaiMan (raimund-hocke) said : #4

please send me the images and a screenshot of the relevant part.

Mail: sikulix---at---outlook---dot---com

RaiMan (raimund-hocke) said : #5

BTW:
- added a simpler .mask() and .mask(ImageOrPattern) (see docs)

- there is a findAllList():

matches = findAllList(image)
for match in matches:
    match.highlight(1)

masuo (masuo-ohara) said : #6

I'm sorry, I did not notice that the document was changed. asMask and withMask are removed from the document and there is only mask. So I will use mask from now on.

RaiMan (raimund-hocke) said : #7

No need to be sorry.

Sometimes the docs tell you nothing about something and then they change without notice ;-)

In this case, the first solution (asMask/withMask) was a bit too detailed and not really straight forward.
So I made it a bit more convenient.

Thanks for your continuous contributions.

RaiMan (raimund-hocke) said : #8

BTW: I would like to use your example with the map and cones as a more general example for the docs.

Is that ok?

Best RaiMan (raimund-hocke) said : #9

The latest build from today should do what you expect.

masuo (masuo-ohara) said : #10

>#8
Please use it.

>#9
I confirmed it worked.

masuo (masuo-ohara) said : #11

Thanks RaiMan, that solved my question.