This commit is contained in:
Administrator
2025-11-05 23:51:06 +08:00
parent 6337567ddf
commit 316710a24c
4 changed files with 15 additions and 13 deletions

14
main.py
View File

@@ -62,6 +62,18 @@ rw = (632, 378)
v = active_group['move_velocity']
def yolo_shibie(im_PIL, detections, model):
detections = {
'center': None,
'next': None,
'npc1': None,
'npc2': None,
'npc3': None,
'npc4': None,
'boss': None,
'daojv': [],
'gw': [],
'zhaozi': None
}
results = model(im_PIL) # 目标检测
for result in results:
for i in range(len(result.boxes.xyxy)):
@@ -186,7 +198,7 @@ while True:
continue
detections = yolo_shibie(im_opencv[1], detections, model)
if shizi.tuwai(im_opencv[0]): # 进图算法
if shizi.tuwai(im_opencv[0]) or yolo_shibie(im_opencv[1], model0)['npc1'] is not None or yolo_shibie(im_opencv[1], model0)['npc2'] is not None or yolo_shibie(im_opencv[1], model0)['npc3'] is not None or yolo_shibie(im_opencv[1], model0)['npc4'] is not None: # 进图算法 # 进图算法
im_opencv = get_image.get_frame() # [RGB,PIL]
if im_opencv is None:
print("⚠️ 无法获取图像帧,跳过本次循环")