Fix: subtract_blur images are never used

This commit is contained in:
LmeSzinc 2023-11-06 22:37:48 +08:00
parent e1468db85d
commit 02fab99431
2 changed files with 3 additions and 4 deletions

View File

@ -187,7 +187,7 @@ class Aim:
draw_circle(draw, self.circle_enemy, points) draw_circle(draw, self.circle_enemy, points)
if self.debug: if self.debug:
self.draw_enemy = cv2.multiply(draw, 4) self.draw_enemy = cv2.multiply(draw, 4)
subtract_blur(draw, 3) draw = subtract_blur(draw, 3)
# Find peaks # Find peaks
points = inrange(draw, lower=36) points = inrange(draw, lower=36)
@ -230,7 +230,6 @@ class Aim:
draw_circle(draw, self.circle_item, points) draw_circle(draw, self.circle_item, points)
if self.debug: if self.debug:
self.draw_item = cv2.multiply(draw, 2) self.draw_item = cv2.multiply(draw, 2)
subtract_blur(draw, 7)
# Find peaks # Find peaks
points = inrange(draw, lower=64) points = inrange(draw, lower=64)

View File

@ -224,7 +224,7 @@ class Minimap(MapResource):
scale = self.DIRECTION_ROTATION_SCALE * self.DIRECTION_SEARCH_SCALE scale = self.DIRECTION_ROTATION_SCALE * self.DIRECTION_SEARCH_SCALE
mapping = cv2.resize(image, None, fx=scale, fy=scale, interpolation=cv2.INTER_NEAREST) mapping = cv2.resize(image, None, fx=scale, fy=scale, interpolation=cv2.INTER_NEAREST)
result = cv2.matchTemplate(self.ArrowRotateMap, mapping, cv2.TM_CCOEFF_NORMED) result = cv2.matchTemplate(self.ArrowRotateMap, mapping, cv2.TM_CCOEFF_NORMED)
subtract_blur(result, 5) result = subtract_blur(result, 5)
_, sim, _, loca = cv2.minMaxLoc(result) _, sim, _, loca = cv2.minMaxLoc(result)
loca = np.array(loca) / self.DIRECTION_SEARCH_SCALE // (self.DIRECTION_RADIUS * 2) loca = np.array(loca) / self.DIRECTION_SEARCH_SCALE // (self.DIRECTION_RADIUS * 2)
degree = int((loca[0] + loca[1] * 8) * 5) degree = int((loca[0] + loca[1] * 8) * 5)
@ -241,7 +241,7 @@ class Minimap(MapResource):
precise_map = self.ArrowRotateMapAll[row[0]:row[1], :] precise_map = self.ArrowRotateMapAll[row[0]:row[1], :]
result = cv2.matchTemplate(precise_map, mapping, cv2.TM_CCOEFF_NORMED) result = cv2.matchTemplate(precise_map, mapping, cv2.TM_CCOEFF_NORMED)
subtract_blur(result, 5) result = subtract_blur(result, 5)
def to_map(x): def to_map(x):
return int((x * self.DIRECTION_RADIUS * 2) * self.POSITION_SEARCH_SCALE) return int((x * self.DIRECTION_RADIUS * 2) * self.POSITION_SEARCH_SCALE)