mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2025-12-16 15:35:12 +00:00
fix: use correct color space for template matching
This commit is contained in:
parent
1a66e767f3
commit
8d2882e752
@ -54,8 +54,7 @@ class Cafe(UI):
|
||||
@staticmethod
|
||||
def _extract_clickable_from_image(image):
|
||||
# convert to hsv for better color matching
|
||||
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
|
||||
hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
|
||||
hsv = cv2.cvtColor(image, cv2.COLOR_RGB2HSV)
|
||||
# set color range
|
||||
lower_hsv = np.array([18, 200, 220])
|
||||
upper_hsv = np.array([30, 255, 255])
|
||||
@ -65,8 +64,8 @@ class Cafe(UI):
|
||||
return cv2.bitwise_and(image, image, mask=mask)
|
||||
|
||||
def _match_clickable_points(self, image, threshold=0.8):
|
||||
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
||||
template = cv2.cvtColor(self.template.matched_button.image, cv2.COLOR_BGR2GRAY)
|
||||
image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
|
||||
template = cv2.cvtColor(self.template.matched_button.image, cv2.COLOR_RGB2GRAY)
|
||||
|
||||
res = cv2.matchTemplate(image, template, cv2.TM_CCOEFF_NORMED)
|
||||
loc = np.where(res >= threshold)
|
||||
|
||||
@ -131,8 +131,8 @@ class StageList:
|
||||
|
||||
@staticmethod
|
||||
def _match_clickable_points(image, template, threshold=0.85):
|
||||
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
||||
template = cv2.cvtColor(template, cv2.COLOR_BGR2GRAY)
|
||||
image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
|
||||
template = cv2.cvtColor(template, cv2.COLOR_RGB2GRAY)
|
||||
|
||||
res = cv2.matchTemplate(image, template, cv2.TM_CCOEFF_NORMED)
|
||||
loc = np.where(res >= threshold)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user