平均色匹配中模板匹配阈值优化
This commit is contained in:
parent
926dba06f1
commit
3c12e538d4
2 changed files with 7 additions and 1 deletions
|
@ -685,7 +685,12 @@ class Recognizer:
|
||||||
img = cropimg(self.img, scope)
|
img = cropimg(self.img, scope)
|
||||||
if cmatch(img, res_img, draw=draw):
|
if cmatch(img, res_img, draw=draw):
|
||||||
score = cv2.matchTemplate(img, res_img, cv2.TM_CCOEFF_NORMED)[0][0]
|
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=}")
|
logger.debug(f"cmatch: {res=} {score=} {scope=}")
|
||||||
return scope
|
return scope
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -341,6 +341,7 @@ template_matching_score = {
|
||||||
"recruit/stone": 0.7,
|
"recruit/stone": 0.7,
|
||||||
"recruit/time": 0.8,
|
"recruit/time": 0.8,
|
||||||
"sign_in/moon_festival/banner": 0.5,
|
"sign_in/moon_festival/banner": 0.5,
|
||||||
|
"sss/add_agent": 0.8,
|
||||||
"sss/drop_EC": 0.8,
|
"sss/drop_EC": 0.8,
|
||||||
"story_skip": 0.7,
|
"story_skip": 0.7,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue