From 28b36c70ffc516cf39532499ea27faa3b9eeb810 Mon Sep 17 00:00:00 2001 From: liusiyang Date: Mon, 19 Oct 2026 17:46:52 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=8F=AA=E8=AF=BB=E5=8D=A1=E5=8F=A3?= =?UTF-8?q?=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/deal.cpp | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/example/deal.cpp b/example/deal.cpp index 3b6ff5b..f31952c 100644 --- a/example/deal.cpp +++ b/example/deal.cpp @@ -1038,7 +1038,7 @@ int deal::GetImgInfo_POL_ET_PNG(std::string strImgPath, JC_IMAGE_INFO_ *pImageIn // -f 批量跑新格式: 解析图片名组装产品信息 // 图片名示例: 1M10121554R2B3_buckle_down2_src.jpg // 产品ID: 第一个 '_' 之前的部分 (1M10121554R2B3) -// 相机名/通道名: 直接匹配文件名中的相机名(如 buckle), 只处理后缀为 _src 的原图 +// 相机名/通道名: 只处理文件名包含 buckle 且后缀为 _src 的原图 int deal::GetImgInfo_SOCKET_SRC(std::string strImgPath, JC_IMAGE_INFO_ *pImageInfo) { if (pImageInfo == NULL) @@ -1048,6 +1048,13 @@ int deal::GetImgInfo_SOCKET_SRC(std::string strImgPath, JC_IMAGE_INFO_ *pImageIn std::string strName = ExtractFileNameWithoutExtension(strImgPath); + // 只处理文件名包含 buckle 的图片, 跳过 t_face_bright/t_face_dark 等其它相机 + if (strName.find("buckle") == std::string::npos) + { + printf("GetImgInfo_SOCKET_SRC: no buckle in name, skip %s\n", strImgPath.c_str()); + return 1; + } + // 只处理后缀为 _src 的原图, 跳过 _roi 等其它图 const std::string strSrcSuffix = "_src"; if (strName.size() <= strSrcSuffix.size() || @@ -1056,25 +1063,8 @@ int deal::GetImgInfo_SOCKET_SRC(std::string strImgPath, JC_IMAGE_INFO_ *pImageIn return 1; } - // 直接匹配文件名中的相机名, 相机名同时作为通道名 - std::string strCamName = ""; - if (strName.find("buckle") != std::string::npos) - { - strCamName = "buckle"; - } - else if (strName.find("t_face_bright") != std::string::npos) - { - strCamName = "t_face_bright"; - } - else if (strName.find("t_face_dark") != std::string::npos) - { - strCamName = "t_face_dark"; - } - if (strCamName == "") - { - printf("GetImgInfo_SOCKET_SRC: no camera match, skip %s\n", strImgPath.c_str()); - return 1; - } + // 相机名同时作为通道名 + std::string strCamName = "buckle"; // 产品ID = 文件名第一个 '_' 之前的部分 std::string strProductID = strName;