Sikuli Exact Image Match Failure

Asked by dinesh

Sikuli doesn't find the exact Image match on the screen (i.e) Test passes even if some part of the text Image changes.

For example,

Expected Image(captured Image for validation)
----------------------

Img3=>XYZOne

I performed three different test by passing different input values to the text field in the screen as shown below

Test 1 :field with the text as => XYZOne
Test 2 :field with the text as=> XYZOn
Test 3 :field with the text as=> XYXOne

My script is for Image validation:
------------------------------------------------

 try {
    Thread.sleep(2);

                        Match image=s.find("Img3.png");
   System.out.println("Image matched");
  } catch (Exception e) {

   System.out.println ("Image not matched");

   e.printStackTrace();
  }

Test Output:
------------------

Test 1:
---------
Test passes as it find the right image on the screen.

Test 2:
---------
Actual text on the screen differs from the expected one on the Img3 but test passes.
Actual one is => XYZOn
Expected Image => XYZOne
(i.e) 'e' missing in the actual text on the screen.

In this test a portion of the text matched hence the test passes which is not the expected behaviour. The test should fail even if there is minor change either at the begging or at the end or at the middle of the text(anywhere)

Test 3:
----------
This test fails as it doesn't find the some part of the test is not matched(may be the first portion of the text). But the same test passes when I used 'exists' command instead of 'find' command in the script.

Therefore there is no reliability with sikuli when it comes to Image comparison. Tool is not finding the exact match(i.e) test should fail even if a single character changes from the expected Image. This behaves very badly when it comes to date field image validation(i.e) test keeps passing even if more than one number changes in the dates.

Could someone advice me on this as how to check the exact Image match with sikuli or Is there is any better way to find the exact Image match.

We need to sort this urgently.

Quick help is appreciated.

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

read this:
http://sikulix-2014.readthedocs.org/en/latest/basicinfo.html#sikulix-how-does-it-find-images-on-the-screen

to understand, how SikuliX works and what you can do, to minimize the risk of false positives.

Revision history for this message
dinesh (dperomy) said :
#2

Hi Raiman,

I tried the below method,
if (s.exists(new Pattern("../QA.Test/ATGBCC/com/bcc/images/mac/NewCategoryPage/img3.png").exact()) !=null)

It runs false and not finding the exact match.

How to find the match score for a captured Image/Matched Image?

 I tried the pattern class by passing(similar(0.99F)) but still it didn't find the exact match.

 (s.exists(new Pattern("img3.png").similar(0.99F) !=null)

Could you please provide some suggestion for the below points

(i) Find out the match score of an Image.
(ii)How to set match to 0.95 or even >0.99 for our Image.

Revision history for this message
dinesh (dperomy) said :
#3

Just an update on the above query

I managed to find the score by using the Sikuli IDE matching preview option.. By default score comes like 0.7 for the captured image but some image need to go below that point say like 0.34 for it's recognition.

I used this score value in the similar() but still it returns true, in this case we expect false as there is minor change in the image(few text changed).

Is there is any better solution for it.

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

--- I managed to find the score by using the Sikuli IDE matching preview
this is not recommended, to find out the match score, that you get while your program is running.
IDE Preview is meant to get some hint in special cases, where you need a similarity score, to use for a Pattern.

You are programming in Java, so you should look at the Java docs:
http://nightly.sikuli.de/docs/index.html

The object returned by exists() is a Match.

... and if you followed comment #1, then you should know, that scores below 0.8 are generally bad scores and scores below 0.7 should be avoided in all cases. The solution is to have good shots as mentioned in the article.

So again: make sure, you have understood, how the SikuliX matching works.

Revision history for this message
Thom Bowden (thombowden) said :
#5

Hi RaiMan and dinesh

I have been looking at essentially the same issue as dinesh describes.

I too have been using the IDE tooling to gauge the score of the image and thus ascertain whether the image would be found on the screen. As far as I understand it;

0.0 - 0.69 would trigger a FindFailed exception. When using exists these should return False

0.7 - 0.99 (or 1?) would return True on exists

0.95-0.99 would return true for exists, exists.exact. 0.94 and below would return false for exact.

I use the IDE tooling to check at what sensitivity point my image starts to be recognised, in my case it is stops finding any matches at 0.41 on the slider. I thus conclude that the png I have captured would be no good to use and I need to rethink the area I capture.

If I try and run the test with the image that could not be found above a 0.41 sensitivity then I expect it to return a False for exists and exact. If I used pattern similar, it should find it at 0.40, as per the IDE. Is this all correct ?

Unfortunately, my call is always returning a True and thus a pass for exists and exact, regardless of when the image is different, or that it only gets recognised by the IDE tool below 0.41

My code is the same as dinesh's example

Can you help with this problem?

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

To post a message you must log in.