1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-11 23:18:22 +08:00

Opt: Allow to set multiple template scaling ratios

This commit is contained in:
LmeSzinc
2021-09-17 18:28:59 +08:00
parent 017df17029
commit b6f5dca0c4
5 changed files with 15 additions and 13 deletions

View File

@@ -168,12 +168,14 @@ class GridPredictor:
short_name = name[6:] if name.startswith('Siren_') else name
scaling = scaling_dic.get(short_name, 1)
if scaling not in image_dic:
shape = tuple(np.round(np.array((60, 60)) * scaling).astype(int))
image_dic[scaling] = rgb2gray(self.relative_crop((-0.5, -1, 0.5, 0), shape=shape))
scaling = (scaling,) if not isinstance(scaling, tuple) else scaling
for scale in scaling:
if scale not in image_dic:
shape = tuple(np.round(np.array((60, 60)) * scale).astype(int))
image_dic[scale] = rgb2gray(self.relative_crop((-0.5, -1, 0.5, 0), shape=shape))
if template.match(image_dic[scaling]):
return name
if template.match(image_dic[scale]):
return name
return None