From 631076f65bf9f2a039fca23073ddb6dc626fee07 Mon Sep 17 00:00:00 2001 From: bsw215583320 <baoshiwei121@163.com> Date: 星期日, 27 四月 2025 15:41:51 +0800 Subject: [PATCH] refactor(herb_ai):优化图像识别和日志记录逻辑 --- openvino/safety_detect.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/openvino/safety_detect.py b/openvino/safety_detect.py index f4d6e6d..c9a96e4 100644 --- a/openvino/safety_detect.py +++ b/openvino/safety_detect.py @@ -79,14 +79,15 @@ cv2.putText(img, label, (x - 10, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 2) def draw_detections(self, frame, class_ids, scores, boxes): + det_img = frame.copy() result_boxes = cv2.dnn.NMSBoxes(boxes, scores, 0.25, 0.45, 0.5) for i in range(len(result_boxes)): index = result_boxes[i] box = boxes[index] - self.draw_bounding_box(frame, class_ids[index], scores[index], round(box[0] * self.scale), round(box[1] * self.scale), + self.draw_bounding_box(det_img, class_ids[index], scores[index], round(box[0] * self.scale), round(box[1] * self.scale), round((box[0] + box[2]) * self.scale), round((box[1] + box[3]) * self.scale)) - return frame + return det_img -- Gitblit v1.9.3