改变Sikuli的敏感度?

时间:2010-03-09 07:10:20

标签: python sikuli

我一直在使用sikuli,但是我有一个问题...它不够灵敏。我试图匹配屏幕上的东西-EXACT-,并且屏幕上还有一些其他项目看起来相似,以至于sikuli误将它们误认为是我实际需要的东西,所以我需要制作它只查找这个项目,没有任何差异。

我该怎么做?

哦,为了进一步解释我的问题,我正在为游戏编写循环,一旦进度条达到100% - 它需要允许循环完成(并重新开始),但是进度条只是一个简单的条形图 - 所以当sikuli在屏幕上查找它时,它会找到部分完整的条形图(因为它显然匹配它所寻找的图像的不同长度/宽度/尺寸)和触发器。

4 个答案:

答案 0 :(得分:6)

您可以在Sikuli IDE中执行以下操作:

  • 点击图片
  • 在模式设置>匹配预览,将相似性栏拖动到1.0(一直到右侧)
  • 点击确定

答案 1 :(得分:3)

如果您正在使用Sikuli IDE,请单击图像微缩,您要为其更改灵敏度。您将看到桌面的屏幕截图以及模式(您的图像)的出现。下面有一个滑块改变灵敏度。在更改它时,您会注意到模式的突出显示会相应地增加或减少 这种方法假定你的游戏在屏幕上(所以窗口模式,而不是全屏模式),但即使你没有,你仍然可以调整灵敏度,只是你不会看到搜索的“实时”结果。

如果从Java代码中调用sikuli,则必须使用Pattern(image.png).similar(y.xx)
其中simmilar的参数介于0.00和1.00之间 我没有使用第二种方法,所以你可能需要试验它。

答案 2 :(得分:0)

以下是否有效? 您正在寻找达到100%的进度然后再循环?

  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():

答案 3 :(得分:0)

要匹配我使用的确切图像:

image1 = ("image1.png")
while not exists (Pattern(image1).exact()): 
       # Wait until that exact image appears. 
       wait(1) 
相关问题