sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #29837
Re: [Question #259550]: issue in comparing two images
Question #259550 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/259550
RaiMan proposed the following answer:
@comment #7
@Eugene
Ok, now I understand, what you mean with "solved in Java API"
in class Location there is a method
getColor()
that internally uses the Robot feature you found and returns a
java.awt.Color object.
So your solution can be made a bit smoother (no need for the Robot):
def findWithColor(img, reg=SCREEN, color=Color(255,255,255), probe=[0,0], debug=False):
res=None
reg.findAll(img)
found=list(reg.getLastMatches())
for but in found:
probePoint=but.getCenter().offset(probe[0],probe[1])
myColor=probePoint.getColor()
if debug:
print "color at "+str(probePoint.x)+":" +str(probePoint.y)+":",myColor
if myColor==color:
res=but
if not debug:
break
return(res)
For a convenient usage on the scripting level, getColor() should return
a list of the RGB values, so you could simply use (no ref to any java
stuff)
if (255, 255, 255) = somePoint.getColore():
print "the spot is white"
--- One more thing:
Again this is only a workaround for the fact, that currently small differences between images (in the sense of OpenCV::matchTemplate()) cannot be detected with Sikuli's weak similariity score implementation (see the other comments above).
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.