Ver código fonte

fix daoguan can't open on 5-7

Merlin 1 ano atrás
pai
commit
eeaff94d27
3 arquivos alterados com 18 adições e 2 exclusões
  1. 17 1
      module/atom/image.py
  2. 1 1
      tasks/Dokan/assets.py
  3. BIN
      tasks/Dokan/res/scene_shenshe.png

+ 17 - 1
module/atom/image.py

@@ -146,7 +146,10 @@ class RuleImage:
         if not self.is_template_match:
         if not self.is_template_match:
             return self.sift_match(image)
             return self.sift_match(image)
             # raise Exception(f"unknown method {self.method}")
             # raise Exception(f"unknown method {self.method}")
-
+        # if self.name == 'SCENE_SHENSHE':
+        #     source = image
+        # else:
+        #     source = self.corp(image)
         source = self.corp(image)
         source = self.corp(image)
         mat = self.image
         mat = self.image
 
 
@@ -157,6 +160,19 @@ class RuleImage:
         res = cv2.matchTemplate(source, mat, cv2.TM_CCOEFF_NORMED)
         res = cv2.matchTemplate(source, mat, cv2.TM_CCOEFF_NORMED)
         min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)  # 最小匹配度,最大匹配度,最小匹配度的坐标,最大匹配度的坐标
         min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)  # 最小匹配度,最大匹配度,最小匹配度的坐标,最大匹配度的坐标
         # logger.attr(self.name, max_val)
         # logger.attr(self.name, max_val)
+        # if self.name == 'SCENE_SHENSHE' and max_val > threshold:
+        #     self.roi_front[0] = max_loc[0]
+        #     self.roi_front[1] = max_loc[1]
+        #     self.roi_front[2] = mat.shape[1]
+        #     self.roi_front[3] = mat.shape[0]
+        #     return True
+        # elif max_val > threshold:
+        #     self.roi_front[0] = max_loc[0] + self.roi_back[0]
+        #     self.roi_front[1] = max_loc[1] + self.roi_back[1]
+        #     return True
+        # else:
+        #     return False
+
         if max_val > threshold:
         if max_val > threshold:
             self.roi_front[0] = max_loc[0] + self.roi_back[0]
             self.roi_front[0] = max_loc[0] + self.roi_back[0]
             self.roi_front[1] = max_loc[1] + self.roi_back[1]
             self.roi_front[1] = max_loc[1] + self.roi_back[1]

+ 1 - 1
tasks/Dokan/assets.py

@@ -115,7 +115,7 @@ class DokanAssets:
 	# 场景检测:阴阳竂 
 	# 场景检测:阴阳竂 
 	I_SCENE_RYOU = RuleImage(roi_front=(1161,674,75,31), roi_back=(1161,674,75,31), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/scene_ryou.png")
 	I_SCENE_RYOU = RuleImage(roi_front=(1161,674,75,31), roi_back=(1161,674,75,31), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/scene_ryou.png")
 	# 场景检测:神社 
 	# 场景检测:神社 
-	I_SCENE_SHENSHE = RuleImage(roi_front=(0,100,600,600), roi_back=(0,100,600,600), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/scene_shenshe.png")
+	I_SCENE_SHENSHE = RuleImage(roi_front=(477,165,63,65), roi_back=(477,165,63,65), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/scene_shenshe.png")
 	# 道馆 地图界面 建立道馆按钮 
 	# 道馆 地图界面 建立道馆按钮 
 	I_RYOU_DOKAN_CREATE_DOKAN = RuleImage(roi_front=(230,580,130,120), roi_back=(230,580,130,120), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_create_dokan.png")
 	I_RYOU_DOKAN_CREATE_DOKAN = RuleImage(roi_front=(230,580,130,120), roi_back=(230,580,130,120), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_create_dokan.png")
 	# 道馆 地图界面 点击建立道馆按钮后弹窗中的 确认按钮 
 	# 道馆 地图界面 点击建立道馆按钮后弹窗中的 确认按钮 

BIN
tasks/Dokan/res/scene_shenshe.png