Finder returns matches no matter the color of the image

Asked by LuisBow

I have been using a couple of SIkuli functionalities to automate GUI testing. I learned about the Finder class recently and have been testing, but I think the returned matches do not take color into consideration. I try to match an image with a green background to the same image but with a white background and it returns 0.949 similarity, making it very difficult to come up with a way to determine which match is the correct one.

Is there a work-around to this or a way I can bring color into the decision process?

Thanks

Question information

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

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

about color evaluation:

# get the color of a point on screen
c = Location(100,100).getColor()

# string representation of color (Java class java.awt.Color)
print c

# value 0...255 for each RGB component
print c.getRed()
print c.getGreen()
print c.getBlue()

# compound RGB value with transparency in 4 byte integer
print c.getRGB()

# array of 3 floats 0...1
cf = list(c.getRGBColorComponents(None))
print cf

... prints in my case:
java.awt.Color[r=231,g=231,b=231]
231
231
231
-1579033
[0.9058823585510254, 0.9058823585510254, 0.9058823585510254]

Revision history for this message
LuisBow (titobogran) said :
#2

Thanks RaiMan! The read was worth it, including how the template matching works.

Revision history for this message
LuisBow (titobogran) said :
#3

Thanks RaiMan, that solved my question.