更改Sikuli的灵敏度?
我用sikuli已经有一段时间了,但遇到了一些问题……它的灵敏度不够。我想在屏幕上找到一个-完全-匹配的东西,但屏幕上还有其他一些看起来相似的东西,sikuli把它们误认为是我真正想要的。所以我需要让它只寻找这个特定的项目,完全不允许有任何差异。
我该怎么做呢?
哦,再详细解释一下我的问题,我正在为一个游戏写一个循环,当进度条达到100%时,它需要允许循环完成(然后重新开始)。但是进度条只是一个普通的条形图,所以当sikuli在屏幕上寻找它时,它会找到一个部分完成的条(因为它似乎会匹配不同长度/宽度/大小的图像),然后触发了。
4 个回答
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
如果你在使用Sikuli IDE,想要调整图像缩略图的灵敏度,你会看到一个你桌面的截图,上面标出了你想要的图案(也就是你的图片)。下面有一个滑块,可以用来改变灵敏度。当你调整这个滑块时,你会发现图案的高亮部分会相应地增加或减少。
这个方法假设你的游戏窗口是打开的(也就是说是窗口模式,而不是全屏),但即使你没有打开游戏,你仍然可以调整灵敏度,只是你看不到搜索的“实时”结果。
如果你是通过Java代码调用Sikuli,你需要使用 Pattern(image.png).similar(y.xx)
这里的similar参数是一个介于0.00到1.00之间的数值。
我没有使用过第二种方法,所以你可能需要自己尝试一下。
8
在Sikuli的开发环境中,你可以这样操作:
- 点击你想要的图片
- 在“模式设置”里找到“匹配预览”,把相似度的滑块拖到最右边,设置为1.0
- 点击确定