This commit is contained in:
parent
d1d9758c61
commit
8eb222b6d3
2 changed files with 34 additions and 12 deletions
|
@ -6,7 +6,7 @@ import cv2
|
|||
from mower.solvers.navigation.utils import generate_name
|
||||
from mower.utils import config
|
||||
from mower.utils.graph import SceneGraphSolver
|
||||
from mower.utils.image import thres2
|
||||
from mower.utils.image import cropimg, loadres
|
||||
from mower.utils.log import logger
|
||||
from mower.utils.scene import Scene
|
||||
from mower.utils.vector import va, vs
|
||||
|
@ -531,15 +531,39 @@ class NavigationSolver(SceneGraphSolver):
|
|||
if not isinstance(self.prefix, int):
|
||||
self.back()
|
||||
return
|
||||
act_scope = ((300, 315), (400, 370))
|
||||
|
||||
if self.find(f"navigation/act/{self.act}", scope=act_scope):
|
||||
if pos := self.find(f"navigation/main/{self.prefix}"):
|
||||
self.tap(pos)
|
||||
else:
|
||||
self.swipe_ext([(932, 554), (1425, 554)], [300], 500, 0.5)
|
||||
else:
|
||||
if self.animation():
|
||||
return
|
||||
img = cropimg(config.recog.gray, ((300, 315), (405, 370)))
|
||||
act, score = 0, 0
|
||||
for i in range(3):
|
||||
result = cv2.matchTemplate(
|
||||
img, loadres(f"navigation/act/{i}", True), cv2.TM_CCOEFF_NORMED
|
||||
)
|
||||
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(result)
|
||||
if max_val > score:
|
||||
act, score = i, max_val
|
||||
if self.act > act:
|
||||
self.ctap((251, 846), 3)
|
||||
return
|
||||
elif self.act < act:
|
||||
self.ctap((230, 175), 3)
|
||||
return
|
||||
prefix_scope = ((1150, 250), (1700, 780))
|
||||
img = cropimg(config.recog.gray, prefix_scope)
|
||||
prefix, score = 0, 0
|
||||
for i in range(15):
|
||||
result = cv2.matchTemplate(
|
||||
img, loadres(f"navigation/main/{i}", True), cv2.TM_CCOEFF_NORMED
|
||||
)
|
||||
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(result)
|
||||
if max_val > score:
|
||||
prefix, score = i, max_val
|
||||
if self.prefix > prefix:
|
||||
self.swipe_ext([(1425, 554), (932, 554)], [300], 500)
|
||||
elif self.prefix < prefix:
|
||||
self.swipe_ext([(932, 554), (1425, 554)], [300], 500)
|
||||
else:
|
||||
self.tap(prefix_scope)
|
||||
elif scene == Scene.TERMINAL_BIOGRAPHY:
|
||||
if self.prefix not in ["OF"]:
|
||||
self.back()
|
||||
|
|
|
@ -285,9 +285,6 @@ template_matching = {
|
|||
"mission_daily_on": ((685, 15), (1910, 100)),
|
||||
"mission_weekly": ((685, 15), (1910, 100)),
|
||||
"mission_weekly_on": ((685, 15), (1910, 100)),
|
||||
"navigation/act/0": (309, 318),
|
||||
"navigation/act/1": (309, 319),
|
||||
"navigation/act/2": (307, 319),
|
||||
"navigation/collection/AP_entry": ((0, 170), (1920, 870)),
|
||||
"navigation/collection/CA_entry": ((0, 170), (1920, 870)),
|
||||
"navigation/collection/CE_entry": ((0, 170), (1920, 870)),
|
||||
|
@ -400,6 +397,7 @@ template_matching_score = {
|
|||
"connecting": 0.7,
|
||||
"fight/pause": 0.8,
|
||||
"navigation/episode": 0.7,
|
||||
"navigation/ope_difficulty": 0.7,
|
||||
"navigation/ope_hard": 0.7,
|
||||
"navigation/ope_hard_small": 0.7,
|
||||
"navigation/ope_normal": 0.7,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue