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列表