← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #278852]: tree node image with expanded(-) and collapsed(+) are not identified seperately

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
You sent me a mail, with the relevant shots, images and scripts.
My mail answer contains stuff, to understand the problem.
Additionally you should read and understand:
http://sikulix-2014.readthedocs.org/en/latest/basicinfo.html#sikulix-how-does-it-find-images-on-the-screen
... if you want to get happy with SikuliX

Your problem:
the 2 images with the + and the - box differ very little in their similarity, so the only chance is, to
- have very "clean" shots (see my shots)
- and check the similarity as base for the decision open/close

in my test with "good" shots I get this
- for the + situation:
closed 0.998786091805
opened 0.980106055737
- for the - situation:
closed 0.977048933506
opened 0.998902320862

so in your case with good shots, the usage of Pattern(img).exact()
instead of just the image should work, since in both cases the not-
matching image has a similarity less than 0.99.

But there are situations, where the differences are only in the range
above 0.99. Then only checking the evaluated similarity helps using
Match.getScore(), which shows you all decimals.

Another option always is, to divide the approach into 2 steps:
1. find the folder symbol with the text
2. look to the left about the + and/or - box

I have put a script into my mail answer, that has a function to check,
wether a folder is closed or not, using this approach.

I hope it is ok, that I put this as a showcase on my blog using your
images as an example (I will blur things in the images, that I think
should be secret).

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.