Question

I've been using sikuli for awhile, however I have an issue with it... It's not sensitive enough. I'm trying to match something on the screen that is -EXACT-, and there are a few other items on the screen that look similar enough that sikuli is mistaking them for what I'm actually looking for, so I need to make it look for ONLY this item with no variances at all.

How can I do this?

Oh and to explain my issue a bit further, I am writing a loop for a game, once a progress bar has reached 100% - it needs to allow the loop to finish (And start over again), however the progress bar is just a plain bar - so when sikuli looks for it on the screen, it finds the partially complete bar (Since apparently it matches different lengths/widths/sizes of the image it is looking for), and triggers.

Was it helpful?

Solution

You can do the following in the Sikuli IDE:

  • Click on the image
  • In Pattern Settings > Matching Preview, drag the Similarity bar to 1.0 (all the way to the right)
  • Click OK

OTHER TIPS

If you are using Sikuli IDE click image miniature, for which you want to change sensitivity. You will be presented screenshot of your desktop with and occurrences of pattern(your image). Below there is a slider witch changes sensitivity. While changing it you will notice that highlighted occurrences of the pattern increase or decrease accordingly.
This method assumes that you have your game on screen (so windowed mode, not fullscreen), but even if you don't you still can adjust sensitivity, just you won't see 'live' results of search.

If you call sikuli from Java code, you have to use Pattern(image.png).similar(y.xx)
where the argument of simmilar is something between 0.00 and 1.00.
I haven't used second method so you may need to experiment with it.

Will the following work?
You are looking for the progress to reach 100% then loop again?

  f = open("C:\\test.htm",'W')
    f.write('<font color="#347C2C">lOOPtEST</font><br />')
    f.write('loop iteration' + (str (count)) + '<br />')
    count = count + 1
    f.close()
COUNT =10
POPUP("LOOPTEST")

//image compare from progress bar

import sikuli.Sikuli *

WebPath =('Z:\\ZZZautomation\\Web\\')

BuildPath = ("Z:\BUILDS\Daily_BUILDS\QA_MainBranch_Install\*.install")
BuildNumber =  glob.glob("Z:\BUILDS\Daily_BUILDS\QA_MainBranch_Install\*.install")
for filename in BuildNumber:
    SmokeTestInfo = "SmokeTest_Build " + filename[45:50] + " Iteration 44"+".htm"
global Number
Number = filename[45:50]

global SmokeTest
SmokeTest = SmokeTestInfo

global count
count = 0

defMidProgress():
    while not exists ("//path to image of progress bar @ 50%//",FOREVER)
    //or
    wait("//path to image of progress bar @ 50%//", FOREVER)
    //using forevEr means sikuli will checK FOR 50% PROGRESS FOREVER
    //the bottom execures once the condition above is met
    open(WebPath + SmokeTest,'w')
    f.write('<font color="#0000FF">Progress is at 50%</font><br />')
    f.close()
    // writes entry to html log fie

defFinalProgress():

    while not exists ("//path to image of progress bar @ 100%//",FOREVER)
    //or
    wait("//path to image of progress bar @ 100%//", FOREVER)
    //using forever means sikuli will check FOR 100% PROGRESS FOREVER
    //the bottom execures once the condition above is met
    open(WebPath + SmokeTest,'a')
    f.write('<font color="#0000FF">Progress is at 100%</font><br />')
    f.close()
    // writes entry to html log fie


def Loop
count =0
 def midProgress():

 def FinalProgress():

To match an exact image I use:

image1 = ("image1.png")
while not exists (Pattern(image1).exact()): 
       # Wait until that exact image appears. 
       wait(1) 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top