This commit is contained in:
parent
dc9f06512a
commit
de4a699098
1 changed files with 15 additions and 12 deletions
|
@ -100,7 +100,9 @@ class RIIC_ChooseSolver(SceneGraphSolver, BaseMixin):
|
|||
return
|
||||
|
||||
if agent_name in agents_dict.keys():
|
||||
if self.is_choosed(agents_dict[agent_name]):
|
||||
is_choosed = self.is_choosed(agents_dict[agent_name])
|
||||
logger.debug(f"{agent_name} 是否被选上:{is_choosed}")
|
||||
if is_choosed:
|
||||
logger.info(f"{agent_name}选择完成")
|
||||
self.choosed.append(agent_name)
|
||||
self.agent = None
|
||||
|
@ -154,22 +156,23 @@ class RIIC_ChooseSolver(SceneGraphSolver, BaseMixin):
|
|||
raise RuntimeError(f"缺少干员 {self.agent[0]}")
|
||||
|
||||
def is_choosed(self, scope) -> bool:
|
||||
if (
|
||||
cropimg(
|
||||
config.recog.img,
|
||||
[
|
||||
[scope[0][0] + 0, scope[0][1] - 128],
|
||||
[scope[0][0] + 1, scope[0][1] - 127],
|
||||
],
|
||||
)[0][0][0]
|
||||
< 50
|
||||
) and cropimg(
|
||||
up_pt = cropimg(
|
||||
config.recog.img,
|
||||
[
|
||||
[scope[0][0] + 0, scope[0][1] - 128],
|
||||
[scope[0][0] + 1, scope[0][1] - 127],
|
||||
],
|
||||
)[0][0][0]
|
||||
|
||||
down_pt = cropimg(
|
||||
config.recog.img,
|
||||
[
|
||||
[scope[0][0] + 0, scope[1][1] + 212],
|
||||
[scope[0][0] + 1, scope[1][1] + 213],
|
||||
],
|
||||
)[0][0][0] < 50:
|
||||
)[0][0][0]
|
||||
logger.debug(f"is_choosed: {up_pt}{down_pt}")
|
||||
if (up_pt < 50) and down_pt < 50:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue