Compare commits
2 Commits
9db83deab6
...
aaa795e00d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aaa795e00d | ||
|
|
316710a24c |
12
config.json
12
config.json
@@ -1,18 +1,8 @@
|
||||
{
|
||||
"groups": [
|
||||
{
|
||||
"name": "电脑2",
|
||||
"serial_port": "COM13",
|
||||
"serial_baudrate": 9600,
|
||||
"camera_index": 1,
|
||||
"camera_width": 1920,
|
||||
"camera_height": 1080,
|
||||
"move_velocity": 400,
|
||||
"active": false
|
||||
},
|
||||
{
|
||||
"name": "服务器",
|
||||
"serial_port": "COM12",
|
||||
"serial_port": "COM16",
|
||||
"serial_baudrate": 9600,
|
||||
"camera_index": 0,
|
||||
"camera_width": 1920,
|
||||
|
||||
14
main.py
14
main.py
@@ -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("⚠️ 无法获取图像帧,跳过本次循环")
|
||||
|
||||
@@ -68,7 +68,7 @@ def tuwai(image):
|
||||
img_bytes = img_encoded.tobytes()
|
||||
result = ocr.classification(img_bytes)
|
||||
print(result)
|
||||
if result == "tap" or result=='tqp' or result=='top':
|
||||
if result == "tap" or result=='tqp' or result=='top' or result=='tp':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user