Sikuli Match object is returned by numerous classes in Sikuli upon a successful successful match. It contains a lot of useful information that can be used for debugging purposes. Hence it is important to be able to read it and understand the implications of certain values on your scripts.
Let's look at the whole Match object string first (below I assume that :
Python:
Java:
The Match object that will be printed out will look something like this:
!!! The similarity score is something that you'd like to look at when your script starts picking incorrect elements on the screen. The reason might be a similarity factor that has been set to a value which is too low. As a result, a wrong element on the screen gets matched successfully
Generally, we want the similarity parameter to be set to a minimum of 0.95. This means that an element is only going to be considered a match if the similarity between it and the provided pattern is 95%.
In some cases there might be some benefit in lowering the similarity score, for example in cases where slight color changes can prevent a match but I do not recommend using values below 0.9 (which is 90%).
This parameter can be set manually like this:
Python:
Java:
Below is an example of a Region object which is similar in many ways however has a couple of additional values that may be interesting.
E
Shows the region's current setting about "should throw FindFailed on image not found"
(Y = yes in the standard, N = no, do not throw)
T
Shows the region's current wait timeout (3 by default )
Let's look at the whole Match object string first (below I assume that :
Python:
matchObj = find("pattern.png")
print matchObj
Java:
Screen s = new Screen();
Match matchObj = s.find("pattern.png");
System.out.println(matchObj.toString());
The Match object that will be printed out will look something like this:
M[209,170 477x42]@S(0)[0,0 1920x1080] S:1.00 Center:447,191
Left Corner
[209,170 477x42]Location of left corner of the detected pattern relative to 0,0 coordinates of the screen
Screen Identifier
Screen 0 (main screen). In multiple screen configuration can be 0 or 1@S(0)
Screen Resolution
[0,0 1920x1080]
Similarity Score
Similarity score values are normalized between 0 and 1. Hence 1.00 means 100% matchS:1.00
!!! The similarity score is something that you'd like to look at when your script starts picking incorrect elements on the screen. The reason might be a similarity factor that has been set to a value which is too low. As a result, a wrong element on the screen gets matched successfully
Generally, we want the similarity parameter to be set to a minimum of 0.95. This means that an element is only going to be considered a match if the similarity between it and the provided pattern is 95%.
In some cases there might be some benefit in lowering the similarity score, for example in cases where slight color changes can prevent a match but I do not recommend using values below 0.9 (which is 90%).
This parameter can be set manually like this:
Python:
setBundlePath("C:\Path")
Java:
ImagePath.setBundlePath("C:/Path/");
Center
Center: 447,191Screen coordinates of the center of the matched pattern
Below is an example of a Region object which is similar in many ways however has a couple of additional values that may be interesting.
R[128,369 24x69]@S(0)[0,0 1280x1024] E:Y, T:3.0
Here you can see that most of the values are similar to the ones discussed above and have an additional 2 values.E
Shows the region's current setting about "should throw FindFailed on image not found"
(Y = yes in the standard, N = no, do not throw)
T
Shows the region's current wait timeout (3 by default )
Comments
Post a Comment