Best way to recognize an image

Asked by andrea

Hi I am facing a strange behaviour on Sikuli, and don't know how to fix.
I am using a Sikuli script on a Citrix Environement to open a Java application. The script is on the citrx server and it is launched by an application that is on the same server. I tested the script from many laptops and it works fine. When I launch the script from some PC, images on the Java application are not always recognized. So my questions are:

1) What is the best way to search image on a screen? Take all image or only a small part that has something that is different from the rest?

2) How to deal when it is not found but I know that image is there. If I use exists() I don't get error and the script go on?

3) If I restrict the search to a small region where I am sure image is there can I use smaller similarity to avoid problem recognition?

Thanks a lot
andrea

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

at 1)
a "good" image should contain as little background as possible and concentrate on the distinguishing parts of the image. It should be found with a similarity score >0.9

at 2)
when using exists() you always should have an else branch, that handles the not found situation - otherwise it makes no sense, to use it (since your script silently continues in case of not found).

at 3)
I do not recommend, to generally work with min similarities below 0.8 to 0.9 (see 1). If you have good images, then restricting the search region should only be necessary, to assure, you get the right match (because somewhere on the screen there might be other possible matches) and to speed up the workflow.

In your case you should analyze what the problem is. I had cases in the past, where visual objects in different environments where rendered differently (eg. added/left shadows, ...) caused by other skin/GUI setups. This might not be obvious for the human watcher, but can be evaluated on the pixel level using image viewers.

Revision history for this message
andrea (andrea-merli69) said :
#2

Ok I understand.
Regarding your last sentence.
"where visual objects in different environments where rendered differently (eg. added/left shadows, ...) caused by other skin/GUI setups. "
If this is my case how I can fix it? Need to copy the image from each client or just trying to restric the image to search to a small portion?

Thanks
Andrea

Revision history for this message
andrea (andrea-merli69) said :
#3

Thanks RaiMan, that solved my question.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

I had many cases, where the differences where only at the edges, so it might be sufficient to take only the inner part of an image.

If this is not possible for some reason, you need an image for every environment.