Pattern detection failing on certain patterns

Asked by Shafiq Khan

Not sure if this is a known bug. These three patterns are various states of a button (on, hover, off): https://www.dropbox.com/s/vojxl09yp8cj2qw/system.zip?dl=0
1.1.0 can't differentiate them even at 99% accuracy.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

I made the following test with your images.
all three images are visible in the region r.

In all cases only the right one is found (see log)

images = ("SystemHover.png", "SystemOff.png", "SystemOn.png")

r = Region(215,138,139,513)

for img in images:
  r.highlight(2)
  found = list(r.findAll(Pattern(img).exact()))
  print img
  for m in found:
    m.highlight(1)
    print m

for img in images:
  r.highlight(2)
  m = r.exists(Pattern(img).exact())
  if m:
    print img
    m.highlight(1)
    print m

--- message area
SystemHover.png
M[255,371 51x15]@S(S(0)[0,0 1440x900]) S:1.00 C:280,378 [0/0 msec]

SystemOff.png
M[259,215 49x14]@S(S(0)[0,0 1440x900]) S:0.99 C:283,222 [0/0 msec]

SystemOn.png
M[256,535 50x15]@S(S(0)[0,0 1440x900]) S:1.00 C:281,542 [0/0 msec]

SystemHover.png
M[255,371 51x15]@S(S(0)[0,0 1440x900]) S:1.00 C:280,378 [5/5 msec]

SystemOff.png
M[259,215 49x14]@S(S(0)[0,0 1440x900]) S:1.00 C:283,222 [4/4 msec]

SystemOn.png
M[256,535 50x15]@S(S(0)[0,0 1440x900]) S:1.00 C:281,542 [4/4 msec]

Revision history for this message
Shafiq Khan (srk8887) said :
#2

OK. May be it has something to do with my test environment. My code structure was as follows:
#while the button is not in on state
    #if the button is in off state, click on it
It was failing because it couldn't differentiate between the two. So when the button was in off state, it thought it was in on state and exiting the while loop.

Can you help with this problem?

Provide an answer of your own, or ask Shafiq Khan for more information if necessary.

To post a message you must log in.