From 8274481bd6b805d8f8d05605b49936db82867785 Mon Sep 17 00:00:00 2001 From: liusiyang Date: Tue, 14 Jul 2026 09:18:08 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=88=86=E5=B0=8F=E6=97=B6=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AlgorithmModule/src/CameraCheckAnalysisy.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/AlgorithmModule/src/CameraCheckAnalysisy.cpp b/AlgorithmModule/src/CameraCheckAnalysisy.cpp index 721b9e6..ada27e9 100644 --- a/AlgorithmModule/src/CameraCheckAnalysisy.cpp +++ b/AlgorithmModule/src/CameraCheckAnalysisy.cpp @@ -1255,15 +1255,18 @@ int CameraCheckAnalysisy::ngImgSave() { auto result_copy = m_pCheck_Result; std::string save_path_root = "/home/aidlux/BOE/FOG/cloud/"; - // 生成当天日期字符串,用于按天组织存储目录 + // 生成当天日期字符串和当前小时字符串,用于按天/小时组织存储目录 time_t now = time(nullptr); struct tm tm_now; localtime_r(&now, &tm_now); char date_buf[16]; strftime(date_buf, sizeof(date_buf), "%Y-%m-%d", &tm_now); std::string date_str(date_buf); + char hour_buf[4]; + strftime(hour_buf, sizeof(hour_buf), "%H", &tm_now); + std::string hour_str(hour_buf); - auto task = std::async(std::launch::async, [result_copy, save_path_root, date_str]() { + auto task = std::async(std::launch::async, [result_copy, save_path_root, date_str, hour_str]() { try { if (!result_copy) return; @@ -1324,12 +1327,14 @@ int CameraCheckAnalysisy::ngImgSave() { std::string safe_channel = SanitizePathComponent(raw_channel); // 只保存NG结果且图像数据非空 - if (!m_CheckResult_shareP->resultMaskImg.empty() && - !m_CheckResult_shareP->resultimg.empty() && - !m_CheckResult_shareP->cutSrcimg.empty()) { + // if ((m_CheckResult_shareP->nresult == 1 || safe_channel == "L255") && + // !m_CheckResult_shareP->resultMaskImg.empty() && + // !m_CheckResult_shareP->resultimg.empty() && + // !m_CheckResult_shareP->cutSrcimg.empty()) + { - // 构建保存目录(使用净化后的组件,包含日期子目录) - std::string save_dir = save_path_root + date_str + "/" + safe_product + "/" + safe_camera + "/"; + // 构建保存目录(使用净化后的组件,包含日期/小时子目录) + std::string save_dir = save_path_root + date_str + "/" + hour_str + "/" + safe_product + "/" + safe_camera + "/"; if (CheckUtil::CreateDir(save_dir) != 0) { cerr << ("Failed to create directory: " + save_dir); continue;