【问题标题】:Change Sikuli's sensitivity?改变斯库里的敏感度?
【发布时间】:2011-01-25 07:39:49
【问题描述】:

我使用 sikuli 已经有一段时间了,但是我遇到了一个问题……它不够敏感。我正在尝试匹配屏幕上的 -EXACT-,屏幕上还有一些其他项目看起来非常相似,以至于 sikuli 误认为它们是我真正想要的,所以我需要做到只寻找完全没有差异的这个项目。

我该怎么做?

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

【问题讨论】:

    标签: python sikuli


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

        【解决方案3】:

        以下方法会起作用吗?
        您正在寻找达到 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():
        

        【讨论】:

          【解决方案4】:

          为了匹配我使用的精确图像:

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

          【讨论】:

            猜你喜欢
            • 2010-12-26
            • 2019-08-02
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2020-11-15
            • 2012-04-27
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多