sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #01361
Re: [Question #145806]: Any possiblity that Sikuli can recognise colors too (Same image with different colors) ?
Question #145806 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/145806
Status: Open => Answered
RaiMan proposed the following answer:
trying to click() on each color element using an image will not work. It
is a known problem, that shapes that only differ in color might not be
found correctly, if Sikuli has the "choice" (more than one element
currently on screen).
I suppose, that the color picker is a fixed element. I usually solve this kind of problem this way:
- somehow get the position of the whole color picker
- calculate the offset of the needed click points relative to the color picker
example:
m = find(<image of color picker>)
red = m.getCenter().left(50)
blue = m.getCenter().right(20)
#.... and more as needed
click(red) # would select red color
The offsets can be measured using the Preview window and manually taken
into the script.
Alternatively you can make a Pattern with a target offset for each element, but I always try to minimize find operations:
red = Pattern(<image of color picker>).targetOffset(-50,0)
blue = Pattern(<image of color picker>).targetOffset(20,0)
#.... and more as needed
click(red) # would select red color
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.