feat: add sweep and task reward automation

This commit is contained in:
admin committed 2026-10-04 19:17:10 +08:00
1 parent 8479cf4981
commit 44d9a617d1
21 files changed
+516 -8

No files matched your search

+7 -2
View File
@@ -51,6 +51,9 @@ class Matcher:
return np.asarray(crop.convert('RGB').resize((562, 1002), Image.Resampling.LANCZOS))
def score(self, frame, spec):
return self.locate(frame, spec)[0]
def locate(self, frame, spec):
name = spec['template']
if name not in self.cache:
p = self.assets / name
@@ -70,8 +73,10 @@ class Matcher:
# for the active home page. Also require similar absolute colors.
difference = float(np.abs(candidate.astype(float) - template.astype(float)).mean())
if difference > spec.get('max_color_difference', 28):
return 0.0
return float(score) if math.isfinite(score) else 0.0
return 0.0, None
if not math.isfinite(score):
return 0.0, None
return float(score), (x1 + x, y1 + y, w, h)
def matches(self, frame, specs):
return all(self.score(frame, s) >= s.get('threshold', 0.86) for s in specs)