1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-12 10:58:21 +08:00

Fix: AzurStats updates

This commit is contained in:
LmeSzinc
2022-10-22 00:39:15 +08:00
parent 796affa7f7
commit 3bd6ade8bb
2 changed files with 27 additions and 0 deletions

View File

@@ -220,7 +220,10 @@ class ItemGrid:
str: Template name.
"""
color = cv2.mean(crop(image, self.template_area))[:3]
# Match frequently hit templates first
names = np.array(list(self.templates.keys()))[np.argsort(list(self.templates_hit.values()))][::-1]
# Match known templates first
names = [name for name in names if not name.isdigit()] + [name for name in names if name.isdigit()]
for name in names:
if color_similar(color1=color, color2=self.colors[name], threshold=30):
res = cv2.matchTemplate(image, self.templates[name], cv2.TM_CCOEFF_NORMED)