← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #189402]: Same image with different colors are the same for Sikuli

 

Question #189402 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/189402

    Status: Open => Answered

RaiMan proposed the following answer:
Tested on my Mac Lion with your images.

I confirm, that both images in both cases give the same score. So the
normal features of Sikuli will not help you.

This is the easiest workaround:

from java.awt import Robot

imgA = "A.png"

m =  find(imgA)
cp = m.getTopLeft().offset(5,5) # select a pixel, that has the background color
r = Robot()
c = r.getPixelColor(cp.x, cp.y) # get the color object
crgb = ( c.getRed(), c.getGreen(), c.getBlue() ) # decode to RGB values
print crgb 

you will get a different color value in both cases, which makes it
possible to decide with one is present.

background: 
--- http://docs.oracle.com/javase/6/docs/api/java/awt/Robot.html
--- http://docs.oracle.com/javase/6/docs/api/java/awt/Color.html

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.