mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2025-12-16 22:05:12 +00:00
fix: Adjust cafe student recognition
This commit is contained in:
parent
51305f7c0b
commit
96b5f1db85
@ -44,14 +44,14 @@ class Cafe(UI):
|
|||||||
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
|
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
|
||||||
hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
|
hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
|
||||||
# set color range
|
# set color range
|
||||||
lower_hsv = np.array([17, 200, 220])
|
lower_hsv = np.array([18, 200, 220])
|
||||||
upper_hsv = np.array([28, 255, 255])
|
upper_hsv = np.array([30, 255, 255])
|
||||||
# get mask
|
# get mask
|
||||||
mask = cv2.inRange(hsv, lower_hsv, upper_hsv)
|
mask = cv2.inRange(hsv, lower_hsv, upper_hsv)
|
||||||
# generate result
|
# generate result
|
||||||
return cv2.bitwise_and(image, image, mask=mask)
|
return cv2.bitwise_and(image, image, mask=mask)
|
||||||
|
|
||||||
def _match_clickable_points(self, image, threshold=0.9):
|
def _match_clickable_points(self, image, threshold=0.8):
|
||||||
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
||||||
template = self.btn.matched_button.image
|
template = self.btn.matched_button.image
|
||||||
template = cv2.cvtColor(template, cv2.COLOR_BGR2GRAY)
|
template = cv2.cvtColor(template, cv2.COLOR_BGR2GRAY)
|
||||||
@ -60,7 +60,7 @@ class Cafe(UI):
|
|||||||
loc = np.where(res >= threshold)
|
loc = np.where(res >= threshold)
|
||||||
return [point for point in zip(*loc[::-1])]
|
return [point for point in zip(*loc[::-1])]
|
||||||
|
|
||||||
def _get_clickable_buttons(self, threshold=0.9, offset=(0, 0)):
|
def _get_clickable_buttons(self, threshold=0.8, offset=(0, 0)):
|
||||||
image = cv2.copyMakeBorder(self.device.image, 20, 20, 10, 60, cv2.BORDER_CONSTANT, value=(0, 0, 0))
|
image = cv2.copyMakeBorder(self.device.image, 20, 20, 10, 60, cv2.BORDER_CONSTANT, value=(0, 0, 0))
|
||||||
image = self._extract_clickable_from_image(image)
|
image = self._extract_clickable_from_image(image)
|
||||||
points = self._match_clickable_points(image, threshold)
|
points = self._match_clickable_points(image, threshold)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user