← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #238506]: Can ColorImageTarget be used with Sikuli IDE?

 

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

RaiMan posted a new comment:
This is currently solvable with SikuliX rather easy too:

lets say, you have the two shots:
button_selected
button_unselected

or 
button_color1
button_color2

usually it is needed, to restrict to the region somehow, where you
expect the button to appear.

reg = <somehow evaluated region>
if (reg.exists(button_color1):
    if (reg.exists(Pattern(button_color1).exact())):
        print "it is color1"
    else
        print "it is color2"

... so the principal approach is:
- first find the image with a normal similarity >0.7, which might be either of the 2 button versions
- then check with similarity exact, which one it is really.

In many cases, depending on how many similar visuals might be found,this might even work without restricting to a region:
if (exists(button_color1):
    if (getLastMatch().exists(Pattern(button_color1).exact())):
        print "it is color1"
    else
        print "it is color2"

If we find a first match, we check the match region only for the real
button.

It should be checked, which version of the button should be used for the
first search.

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