Skip to content

Commit

Permalink
arrange_confirm 手动添加阈值
Browse files Browse the repository at this point in the history
  • Loading branch information
Shawnsdaddy committed Nov 12, 2024
1 parent 54a0e81 commit 12028db
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions arknights_mower/utils/recognize.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,28 @@ def find(
"terminal_pre2": (1459, 797),
}

template_matching_score = {
"connecting": 0.7,
"navigation/ope_hard": 0.7,
"navigation/ope_hard_small": 0.7,
"navigation/ope_normal": 0.7,
"navigation/ope_normal_small": 0.7,
"recruit/agent_token": 0.8,
"recruit/agent_token_first": 0.8,
"recruit/lmb": 0.7,
"recruit/riic_res/CASTER": 0.7,
"recruit/riic_res/MEDIC": 0.7,
"recruit/riic_res/PIONEER": 0.7,
"recruit/riic_res/SPECIAL": 0.7,
"recruit/riic_res/SNIPER": 0.7,
"recruit/riic_res/SUPPORT": 0.7,
"recruit/riic_res/TANK": 0.7,
"recruit/riic_res/WARRIOR": 0.7,
"recruit/time": 0.8,
"recruit/stone": 0.7,
"arrange_confirm": 0.85,
}

if res in color:
res_img = loadres(res)
h, w, _ = res_img.shape
Expand All @@ -735,7 +757,10 @@ def find(
res_img = cv2.cvtColor(res_img, cv2.COLOR_RGB2GRAY)
ssim = structural_similarity(gray, res_img)
logger.debug(f"{ssim=}")
if ssim >= 0.9:
threshold = 0.9
if res in template_matching_score:
threshold = template_matching_score[res]
if ssim >= threshold:
return scope

return None
Expand Down Expand Up @@ -812,27 +837,6 @@ def find(
"upgrade": (997, 501),
}

template_matching_score = {
"connecting": 0.7,
"navigation/ope_hard": 0.7,
"navigation/ope_hard_small": 0.7,
"navigation/ope_normal": 0.7,
"navigation/ope_normal_small": 0.7,
"recruit/agent_token": 0.8,
"recruit/agent_token_first": 0.8,
"recruit/lmb": 0.7,
"recruit/riic_res/CASTER": 0.7,
"recruit/riic_res/MEDIC": 0.7,
"recruit/riic_res/PIONEER": 0.7,
"recruit/riic_res/SPECIAL": 0.7,
"recruit/riic_res/SNIPER": 0.7,
"recruit/riic_res/SUPPORT": 0.7,
"recruit/riic_res/TANK": 0.7,
"recruit/riic_res/WARRIOR": 0.7,
"recruit/time": 0.8,
"recruit/stone": 0.7,
}

if res in template_matching:
threshold = 0.9
if res in template_matching_score:
Expand Down

0 comments on commit 12028db

Please sign in to comment.