sikuli incorrectly matches differing images despite exact()

Asked by Vahan

We are trying to use Sikulix-1.1 for automated QA. The OS is Windows 7 professional 64bit (the java is 32-bit), we are using Jython.

In our test, we need to verify that images match exactly. To verify the test works, we use a slightly modified image (in a way that is significant for our test), to see if sikuli will catch the problem.

Even with find(Pattern(<image>).exact()), sikuli incorrectly assumes the images are matched.

Interestingly, Matching Preview does NOT show the images to be matched at precision below 0.96.

N.B. We do have Image.reset() at the start of the script, and the same behavior occurs when launching from the command line, so this is not an IDE image caching issue.

N.B. The background is dark but not exactly black, so this isn't the 'sikuli doesn't work correctly on black background, either', although that's potentially a bad one for us too.

I've attached what we have on the screen, what we're looking for and what the actual difference is (shown via red rectangle on the first image).

Is there a way to make it work? We are now worried that all the tests we write in sikuli are potentially useless as they don't detect differences...

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

this is normal behavior. See comment in related question

Revision history for this message
Vahan (vahanm) said :
#2

Where is the related question?

Revision history for this message
RaiMan (raimund-hocke) said :
#3

This is here ;-) (auto copied from the bug)

I made some tests with your images and cannot reproduce the behavior.

Having your screen_area_excerpt.png on the screen and using find_this .png,

... exact() does not match
... just using the image (standard 0.7) gives 0.982280552387 as score.

I have to admit, that I am testing with version 1.1.1

Revision history for this message
RaiMan (raimund-hocke) said :
#4

I generally recommend to not use exact(), since it internally takes everything > 0.99 as exact match.

If you need to differentiate with a smaller granularity as in your case, you should use the approach:

m = find(someImage)
print m.getScore()

Revision history for this message
RaiMan (raimund-hocke) said :
#5
Revision history for this message
Vahan (vahanm) said :
#6

Thank you, I had a look at the article. getScore() instead of exact( ) will solve our problem. (getScore( ) returns 0.99028 for me, which explains why exact( ) succeeds on my side.)

However, there's one aspect that is still not clear to me.

find(Pattern("...").exact()).highlight() I get this output:

[log] toggle highlight M[151,206 749x55]@S(S(0)[0,0 1600x900]) S:0.99 C:525,233 [315 msec]: true (note the 0.99)

Just using the image I get:

[log] toggle highlight M[151,206 749x55]@S(S(0)[0,0 1600x900]) S:0.98 C:525,233 [161 msec]: true (note the 0.98)

Shouldn't the similarity value in the second case be the same? Based on the article, my understanding was that the specified similarity value (0.7 in the second case) is just for cutoff and the "S" value reported should be the same in both cases - the maximum similarity value in the matrix.

So my question is: why are the similarity values different?

Can you help with this problem?

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

To post a message you must log in.