Skip to content

Commit 8d68721

Browse files
author
caishilong
committed
fix:formatfix
1 parent 55b1d9e commit 8d68721

22 files changed

Lines changed: 512 additions & 345 deletions

examples/basic_usage.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def example_basic_usage():
1616
print("=== 示例1: 基础使用 ===")
1717

1818
# 读取截图
19-
screenshot_path = 'screenshot.png'
20-
template_path = 'template.png'
19+
screenshot_path = "screenshot.png"
20+
template_path = "template.png"
2121

2222
if not os.path.exists(screenshot_path):
2323
print(f"请确保 {screenshot_path} 存在")
@@ -41,8 +41,8 @@ def example_all_locations():
4141
"""
4242
print("\n=== 示例2: 查找所有匹配位置 ===")
4343

44-
screenshot_path = 'screenshot.png'
45-
template_path = 'template.png'
44+
screenshot_path = "screenshot.png"
45+
template_path = "template.png"
4646

4747
if not os.path.exists(screenshot_path):
4848
print(f"请确保 {screenshot_path} 存在")
@@ -66,8 +66,8 @@ def example_template_usage():
6666
"""
6767
print("\n=== 示例3: 使用 Template 类 ===")
6868

69-
screenshot_path = 'screenshot.png'
70-
template_path = 'template.png'
69+
screenshot_path = "screenshot.png"
70+
template_path = "template.png"
7171

7272
if not os.path.exists(screenshot_path):
7373
print(f"请确保 {screenshot_path} 存在")
@@ -94,8 +94,8 @@ def example_multiple_templates():
9494
"""
9595
print("\n=== 示例4: 识别多个模板 ===")
9696

97-
screenshot_path = 'screenshot.png'
98-
templates = ['button1.png', 'button2.png', 'button3.png']
97+
screenshot_path = "screenshot.png"
98+
templates = ["button1.png", "button2.png", "button3.png"]
9999

100100
if not os.path.exists(screenshot_path):
101101
print(f"请确保 {screenshot_path} 存在")
@@ -139,8 +139,8 @@ def example_with_threshold():
139139
"""
140140
print("\n=== 示例6: 阈值调整 ===")
141141

142-
screenshot_path = 'screenshot.png'
143-
template_path = 'template.png'
142+
screenshot_path = "screenshot.png"
143+
template_path = "template.png"
144144

145145
if not os.path.exists(screenshot_path):
146146
print(f"请确保 {screenshot_path} 存在")
@@ -168,15 +168,15 @@ def example_advanced_matching():
168168

169169
from svision.aircv.settings import Settings
170170

171-
screenshot_path = 'screenshot.png'
172-
template_path = 'template.png'
171+
screenshot_path = "screenshot.png"
172+
template_path = "template.png"
173173

174174
if not os.path.exists(screenshot_path):
175175
print(f"请确保 {screenshot_path} 存在")
176176
return
177177

178178
# 配置匹配策略
179-
Settings.CVSTRATEGY = ('tpl', 'gmstpl', 'kaze', 'brisk')
179+
Settings.CVSTRATEGY = ("tpl", "gmstpl", "kaze", "brisk")
180180

181181
# 创建模板对象
182182
template = Template(template_path, threshold=0.8)
@@ -252,5 +252,5 @@ def main():
252252
print("=" * 50)
253253

254254

255-
if __name__ == '__main__':
255+
if __name__ == "__main__":
256256
main()

0 commit comments

Comments
 (0)