Region.highlight() fade out might influence directly following find ops

Bug #1087315 reported by Joost
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Fix Released
Critical
RaiMan

Bug Description

---- summary and workaround
in the given case this was the test code in principal:

exists(image)
getLastMatch().highlight(2)
find(image)

The find() did not match the same or even failed compared to the previous exists().

The reason is the asynchronous fade out of the highlight frame, that is still present on the search screenshot of the following find.

-- workaround:
exists(image)
getLastMatch().highlight(2); wait(1)
find(image)

the additional wait() pauses the script until the highlight frame has vanished.

This is accepted as a bug.

-------------------------------------------------------------------------

I have the following situation: I'm trying to see if one variant of an image exists, and if it doesn't, then I continue to the next variant.

I'm using the IDE to determine the match parameters; the threshold for my value to appear in the matches is 0.58; below that, it will give me false positives. As the color does not need to match perfectly, I'm currently matching at 0.75. However, when I use the exists() method, it will return me a _false positive_, but the match is high; 0.77. This is incorrect and inconsistent with the find() method, which would have ignored this piece.

The image i'm trying to match is an orange button, with white text; on the page, it will match a piece of a band of solid gray, the same size, but it has none of the details that the source image exhibits.

Is this a known issue? And if so, apart from different pattern match criteria, can I do to avoid having this discrepancy?

BTW: still on W7/64 with r930. Vision algorithm is at its default settings, haven't changed anything there. Can send the images by email on request, but I'd rather not share on a public place.

Revision history for this message
RaiMan (raimund-hocke) wrote :

That's interesting, but not understandable, because internally, the only difference between find() and exists(), is that with exists() the FindFailed exception is catched internally and turned into a true or false respectively.

I will come back on that after Dec 18th (vacation ;-).

You might send me some screenshots/probes to my mail at https://launchpad.net/~raimund-hocke
Pls. do not post my real mail address here.

Changed in sikuli:
assignee: nobody → RaiMan (raimund-hocke)
Revision history for this message
Joost (joostvanpinxten) wrote :

So, to clarify, this behavior occurs on the following setting:

p = Pattern("image1.png").similar(0.75))):

if(exists(p)): # sets the last match
  click(getLastMatch()) # has a different similarity score (higher) than the match returned by find(p)

I'll also mail you the corresponding images RaiMan. I hope this clears up that it's probably specifically a bug with exists and getLastMatch() usage.

Revision history for this message
Joost (joostvanpinxten) wrote :

Also, RaiMan, I'm on the latest version of Sikuli (r930) and when I use

print exists(pattern)

then it returns me a _Match_ with a similarity score higher than I get with find() not a Boolean.

RaiMan (raimund-hocke)
Changed in sikuli:
status: New → In Progress
milestone: none → x1.0
RaiMan (raimund-hocke)
summary: - Exists behavior: pattern matching score differs between IDE and actual
- run
+ Region.highlight() fade out might influence following find ops
RaiMan (raimund-hocke)
summary: - Region.highlight() fade out might influence following find ops
+ Region.highlight() fade out might influence directly following find ops
description: updated
RaiMan (raimund-hocke)
Changed in sikuli:
status: In Progress → Fix Committed
RaiMan (raimund-hocke)
tags: added: fkt-highlight
RaiMan (raimund-hocke)
Changed in sikuli:
importance: Undecided → High
RaiMan (raimund-hocke)
Changed in sikuli:
importance: High → Critical
RaiMan (raimund-hocke)
Changed in sikuli:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.