From 70ca852dfa347d4f74f14aabbfb6cbe323aa6c08 Mon Sep 17 00:00:00 2001 From: liusiyang Date: Tue, 13 Oct 2026 20:45:11 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=A0=87=E7=AD=BE=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E5=87=BA=E7=9A=84=E7=BC=BA=E9=99=B7=E8=83=BD=E9=87=8F=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AlgorithmModule/src/ImgCheckAnalysisy.cpp | 24 ++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/AlgorithmModule/src/ImgCheckAnalysisy.cpp b/AlgorithmModule/src/ImgCheckAnalysisy.cpp index d086c47..3cf797b 100644 --- a/AlgorithmModule/src/ImgCheckAnalysisy.cpp +++ b/AlgorithmModule/src/ImgCheckAnalysisy.cpp @@ -4,6 +4,10 @@ #include "Define.h" #include #include "AICommonDefine.h" +// BQ blob 来源标记:写入 ERROR_DOTS_BLOB_DATA::UserErrorType 字段。 +// BQ blob 的分类结果会覆盖 ErrType,用该标记记录来源掩码是 BQ mask, +// 供 CalBlob_Other / CalBLobMean_GrayDis 在计算能量、灰度时选中正确的 mask。 +static const int BQ_BLOB_SOURCE_FLAG = -100; // 用于排序轮廓的比较函数 static bool compareContourAreas(const vector &contour1, const vector &contour2) { @@ -306,8 +310,7 @@ cv::Scalar ImgCheckAnalysisy::calc_blob_info_withstats(cv::Mat &img, const cv::M // CheckUtil::printROI(roi, "roi-----------"); // printf("img --%d %d \n", img.cols, img.rows); // printf("mask --%d %d \n", mask.cols, mask.rows); - cv::Mat cmask = mask(roi); - // getchar(); + cv::Mat cmask = mask(roi); // getchar(); // 扩张掩膜 cv::Scalar mean_bk = cv::mean(cimg, ~cmask); @@ -746,8 +749,13 @@ int ImgCheckAnalysisy::CalBlob_Other() int config_qx_type = blobs.blobTab[i].ErrType; std::shared_ptr pDetAIResult = m_pImageAllResult->qx_DetAIResult; + // BQ 标签检测的 blob:来源 mask 是 BQ mask(分类线程会改 ErrType,靠 UserErrorType 标记识别) + if (blobs.blobTab[i].UserErrorType == BQ_BLOB_SOURCE_FLAG && m_pImageAllResult->bq_DetAIResult) + { + pDetAIResult = m_pImageAllResult->bq_DetAIResult; + } // 127cell 检测类型。 - if (config_qx_type == CONFIG_QX_NAME_white_Cell || config_qx_type == CONFIG_QX_NAME_black_Cell) + else if (config_qx_type == CONFIG_QX_NAME_white_Cell || config_qx_type == CONFIG_QX_NAME_black_Cell) { pDetAIResult = m_pImageAllResult->cell127_DetAIResult; } @@ -1091,8 +1099,13 @@ int ImgCheckAnalysisy::CalBLobMean_GrayDis() int config_qx_type = blobs.blobTab[i].ErrType; std::shared_ptr pDetAIResult = m_pImageAllResult->qx_DetAIResult; + // BQ 标签检测的 blob:来源 mask 是 BQ mask(分类线程会改 ErrType,靠 UserErrorType 标记识别) + if (blobs.blobTab[i].UserErrorType == BQ_BLOB_SOURCE_FLAG && m_pImageAllResult->bq_DetAIResult) + { + pDetAIResult = m_pImageAllResult->bq_DetAIResult; + } // 127cell 检测类型。 - if (config_qx_type == CONFIG_QX_NAME_white_Cell || config_qx_type == CONFIG_QX_NAME_black_Cell) + else if (config_qx_type == CONFIG_QX_NAME_white_Cell || config_qx_type == CONFIG_QX_NAME_black_Cell) { pDetAIResult = m_pImageAllResult->cell127_DetAIResult; } @@ -2601,7 +2614,8 @@ int ImgCheckAnalysisy::GetBlob_BQ() // 使用非cell类型,确保进入AI_Classify_New分类流程 for (int i = 0; i < blobs_bq.blobCount; i++) { - blobs_bq.blobTab[i].ErrType = CONFIG_QX_NAME_LD; // 以亮点作为初始类型,后续分类修正 + blobs_bq.blobTab[i].ErrType = CONFIG_QX_NAME_LD; // 以亮点作为初始类型,后续分类修正 + blobs_bq.blobTab[i].UserErrorType = BQ_BLOB_SOURCE_FLAG; // 标记来源=BQ mask,能量/灰度按 BQ mask 计算 } // 将BQ的blob汇入主blob列表