Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/352.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Sikulli:将区域传递给setROI()函数_Python_Sikuli_Regions - Fatal编程技术网

Python Sikulli:将区域传递给setROI()函数

Python Sikulli:将区域传递给setROI()函数,python,sikuli,regions,Python,Sikuli,Regions,假设在Sikulli中,我创建了一个名为myRegion的区域,并将其传递给setROI()。使用find(PictureIwantFind)是否会像不使用setROI()而改为使用find(myRegion.inside()。exists(PictureIwantFind))一样快 此外,setROI()将继续使用该感兴趣区域,直到您告诉它其他情况,如setROI(屏幕)?如您所述,是的,我相信使用setROI()会比find(myRegion.inside().exists(PictureY

假设在Sikulli中,我创建了一个名为myRegion的区域,并将其传递给setROI()。使用find(PictureIwantFind)是否会像不使用setROI()而改为使用find(myRegion.inside()。exists(PictureIwantFind))一样快


此外,setROI()将继续使用该感兴趣区域,直到您告诉它其他情况,如setROI(屏幕)?

如您所述,是的,我相信使用setROI()会比find(myRegion.inside().exists(PictureYouWantToFind))稍微快一点

-但是-

  • 因为find()操作是Region类的一个方法,所以不需要调用
    find(myRegion.inside().exists(myPic))
    ,您可以通过这种方式更简单地完成同样的事情:
    myRegion.find(myPic)

  • 默认ROI是用保留字“screen”引用的整个屏幕。因此,find(myPic)与screen.find(myPic)相同。将myRegion传递给setROI(),就像在setROI(myRegion)中一样,重新定义screen,以便现在screen=myRegion。如果选择使用setROI(),请注意以下所有区域操作(例如wait()或exists())根据Sikuli论坛上的回答,在你重新定义之前,将对myRegion而不是整个屏幕进行操作

  • 总之,
    myRegion.find(myPic)
    将允许您搜索较小的ROI,而无需重命名屏幕