same image different colour

Asked by Maniraj on 2017-12-27


I am using same image with different colour - it needs to failed but it is getting pass it should not be.

how to overcome this without using Exact.

 Note -- (i am using similarity 0.9) and I am trying find image in screenshot not in screen.

Help me to get resolve this.

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

using something like this ?

f = Finder(screenshot)
if f.hasNext():
   print "found:",
   print "not found"

using version 1.1.1 or later?

Maniraj (aathimaniraj) said : #2

yes using later 1.1.2,

i am using like this, (Both are same) i think so

 String imagePath = "/Users/aathi/Desktop/websitestab/temp/"+imageName;
    BufferedImage regionsetimage = ScreenCapture(driver,imageName);
    Finder window = new Finder(regionsetimage);
    Pattern testImage = new Pattern(imagePath);
    window.find(testImage.similar((float) 0.9));
    Match found = null;
    if (window.hasNext())
      found =;
      System.out.println(imageName + " Image found");
      System.out.println(imageName + " Image Not found");


RaiMan (raimund-hocke) said : #3

ok, you should inspect the score, to make your decision:

      found =;
      double score = found.getScore();
      System.out.println(String.format("found: %s (%.15f)", imageName, score));

Maniraj (aathimaniraj) said : #4

with above mentioned comment #3

i get score more than 0.99 but the image is same with diff colour.

In my case it needs to get fail but it is not happening.

help me out with better solution i am using java selenium. for code structure Refer Comment #2

RaiMan (raimund-hocke) said : #5

Both images return different scores > 0.99, so it is possible to decide, which one was found.

Maniraj (aathimaniraj) said : #6

i can't able to understand what your telling in comment#5 can you explain me in detail

Both images return different scores > 0.99, so it is possible to decide, which one was found - i am using capture image as Expected image compare that image with actual image in this both image means what u referring..

Best RaiMan (raimund-hocke) said : #7

comment #5 refers to your comment #4 which in turn refers to comment #3 !!!

all taken together:

found =;
double score = found.getScore();
if (score < 0.9978563) // would mean fail

You have to find out, what the 0.9978563-value in your case must be in what situation.

If the different colors are background colors towards the edges, then make your images smaller, to concentrate on non-background.

which applies to your situation too.

You still do not fully understand, how SikuliX find feature works.

Maniraj (aathimaniraj) said : #8

Thanks RaiMan, that solved my question.