|
|
|
|
@ -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;
|
|
|
|
|
|