平均色匹配中模板匹配阈值优化

This commit is contained in:
Elaina 2024-11-29 23:23:36 +08:00
parent 926dba06f1
commit 3c12e538d4
2 changed files with 7 additions and 1 deletions

View file

@ -685,7 +685,12 @@ class Recognizer:
img = cropimg(self.img, scope)
if cmatch(img, res_img, draw=draw):
score = cv2.matchTemplate(img, res_img, cv2.TM_CCOEFF_NORMED)[0][0]
if score >= 0.85:
threshold = (
template_matching_score[res]
if res in template_matching_score
else 0.9
)
if score >= threshold:
logger.debug(f"cmatch: {res=} {score=} {scope=}")
return scope
return None

View file

@ -341,6 +341,7 @@ template_matching_score = {
"recruit/stone": 0.7,
"recruit/time": 0.8,
"sign_in/moon_festival/banner": 0.5,
"sss/add_agent": 0.8,
"sss/drop_EC": 0.8,
"story_skip": 0.7,
}