删除RecognizeError
This commit is contained in:
parent
fee5eaccd5
commit
df7f58bca0
2 changed files with 4 additions and 26 deletions
|
@ -17,10 +17,6 @@ from mower.utils.vector import clamp_scope, va
|
|||
from .data import color, template_matching, template_matching_score
|
||||
|
||||
|
||||
class RecognizeError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class Recognizer:
|
||||
def __init__(self, image: Optional[tp.Image] = None) -> None:
|
||||
self.w = 1920
|
||||
|
|
|
@ -64,7 +64,7 @@ from mower.utils.email import send_message
|
|||
from mower.utils.image import cropimg, diff_ratio, loadres, thres2
|
||||
from mower.utils.log import logger
|
||||
from mower.utils.matcher import GOOD_DISTANCE_LIMIT, flann, keypoints_scale_invariant
|
||||
from mower.utils.recognize import RecognizeError, Scene
|
||||
from mower.utils.recognize import Scene
|
||||
from mower.utils.traceback import caller_info
|
||||
from mower.utils.vector import clamp_vector
|
||||
|
||||
|
@ -168,7 +168,7 @@ class BaseSolver:
|
|||
) -> tp.Coordinate:
|
||||
"""get the pos form tp.Location"""
|
||||
if poly is None:
|
||||
raise RecognizeError("poly is empty")
|
||||
raise Exception("poly is empty")
|
||||
elif len(poly) == 4:
|
||||
# tp.Rectangle
|
||||
x = (
|
||||
|
@ -225,14 +225,14 @@ class BaseSolver:
|
|||
|
||||
Raises:
|
||||
MowerExit: 停止运行
|
||||
RecognizeError: 未识别到元素
|
||||
Exception: 未识别到元素
|
||||
"""
|
||||
if config.stop_mower.is_set():
|
||||
raise MowerExit
|
||||
if isinstance(name, str):
|
||||
pos = self.find(name)
|
||||
if pos is None:
|
||||
raise RecognizeError(f"未识别到{name}元素")
|
||||
raise Exception(f"未识别到{name}元素")
|
||||
else:
|
||||
pos = name
|
||||
config.tap_info = None, None
|
||||
|
@ -546,24 +546,6 @@ class BaseSolver:
|
|||
"""get the current scene in the game"""
|
||||
return config.recog.get_scene()
|
||||
|
||||
def ra_scene(self) -> int:
|
||||
"""
|
||||
生息演算场景识别
|
||||
"""
|
||||
return config.recog.get_ra_scene()
|
||||
|
||||
def sf_scene(self) -> int:
|
||||
"""
|
||||
隐秘战线场景识别
|
||||
"""
|
||||
return config.recog.get_sf_scene()
|
||||
|
||||
def train_scene(self) -> int:
|
||||
"""
|
||||
训练室景识别
|
||||
"""
|
||||
return config.recog.get_train_scene()
|
||||
|
||||
def solve_captcha(self, refresh=False):
|
||||
th = thres2(config.recog.gray, 254)
|
||||
pos = np.nonzero(th)
|
||||
|
|
Loading…
Add table
Reference in a new issue