From 234e11eadc29bbe916c4ad575c66a335f9aaab4b Mon Sep 17 00:00:00 2001 From: havoc420ubuntu <2993167370@qq.com> Date: Mon, 19 May 2025 12:53:12 +0000 Subject: [PATCH] add save ori --- utils/detect_track.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/utils/detect_track.py b/utils/detect_track.py index 360bb6b..8f788ec 100644 --- a/utils/detect_track.py +++ b/utils/detect_track.py @@ -310,6 +310,12 @@ def detect_horizontal_track_edge(image, observe=False, delay=1000, save_log=True timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_%f") log_dir = "logs/image" os.makedirs(log_dir, exist_ok=True) + + # 保存原图 + origin_image_path = os.path.join(log_dir, f"origin_horizontal_edge_{timestamp}.jpg") + cv2.imwrite(origin_image_path, img) + info(f"保存原始图像到: {origin_image_path}", "日志") + img_path = os.path.join(log_dir, f"horizontal_edge_{timestamp}.jpg") cv2.imwrite(img_path, result_img) info(f"保存横向边缘检测结果图像到: {img_path}", "日志") @@ -819,6 +825,12 @@ def detect_left_side_track(image, observe=False, delay=1000, save_log=True): timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_%f") log_dir = "logs/image" os.makedirs(log_dir, exist_ok=True) + + # 保存原图 + original_img_path = os.path.join(log_dir, f"original_{timestamp}.jpg") + cv2.imwrite(original_img_path, img) + info(f"保存原始图像到: {original_img_path}", "日志") + img_path = os.path.join(log_dir, f"left_track_{timestamp}.jpg") cv2.imwrite(img_path, result_img) info(f"保存左侧轨迹线检测结果图像到: {img_path}", "日志")