调整
This commit is contained in:
parent
6aee19b84b
commit
f95b0b741d
Binary file not shown.
Before Width: | Height: | Size: 2.9 MiB After Width: | Height: | Size: 21 KiB |
2
main.py
2
main.py
@ -23,7 +23,7 @@ if __name__ == '__main__':
|
||||
# if loc is not None:
|
||||
# x, y = loc
|
||||
# moveTo(x, y)
|
||||
loc = utils.cv2.match_resize(pim, "assets/images/win_win10.png", 0.8)
|
||||
loc = utils.cv2.match_resize(pim, "assets/images/test.png", 0.8)
|
||||
if loc is not None:
|
||||
x, y = loc
|
||||
moveTo(x, y)
|
||||
|
@ -23,13 +23,14 @@ def match_resize(src: Image, tmpl: str, similarity=0.9, step=10, fast=False):
|
||||
if fast:
|
||||
if found is not None and found_location is not None:
|
||||
print(found[2], found_location[2])
|
||||
if tmp_r < r and found[2] > found_location[2]:
|
||||
if tmp_r < r and found[2] > found_location[2] and found[2] >= similarity:
|
||||
break
|
||||
tmp_r = r
|
||||
# 如果我们找到了一个新的最大校正值,更新簿记变量值
|
||||
if found is None or (
|
||||
found_location is not None and found_location[2] >= similarity and found_location[2] > found[2]):
|
||||
if found is None or (found_location is not None and found_location[2] > found[2]):
|
||||
found = found_location
|
||||
if found is not None and found[2] >= similarity:
|
||||
break
|
||||
if found is None:
|
||||
return None
|
||||
x, y, _ = found
|
||||
|
Loading…
Reference in New Issue
Block a user