From 0f54b521f63a7ca23daa4440c89f693db1de4edd Mon Sep 17 00:00:00 2001 From: liusiyang Date: Thu, 8 Oct 2026 10:45:50 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=9A=97=E5=9C=BA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=98=8E=E5=9C=BA=E5=AE=9A=E4=BD=8D=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AlgorithmModule/include/AlignShare.h | 54 ++++ AlgorithmModule/include/Define_Base.h | 10 + AlgorithmModule/include/ImageDetConfig.h | 29 +++ AlgorithmModule/include/ImgCheckAnalysisy.hpp | 7 + AlgorithmModule/src/ALLImgCheckAnalysisy.cpp | 22 ++ AlgorithmModule/src/AlignShare.cpp | 72 ++++++ AlgorithmModule/src/ImgCheckAnalysisy.cpp | 236 +++++++++++++++++- 7 files changed, 421 insertions(+), 9 deletions(-) create mode 100644 AlgorithmModule/include/AlignShare.h create mode 100644 AlgorithmModule/src/AlignShare.cpp diff --git a/AlgorithmModule/include/AlignShare.h b/AlgorithmModule/include/AlignShare.h new file mode 100644 index 0000000..7be494b --- /dev/null +++ b/AlgorithmModule/include/AlignShare.h @@ -0,0 +1,54 @@ +/* +// 定位结果共享(暗场相机复用明场相机的定位结果) +// 背景:bright/dark 两台相机拍同一产品,暗场图不做定位模型(Align_Outer/Align_Inner/Tag_Loc), +// 直接复用明场相机的定位结果(外/内轮廓 roi、标签 roi、bigmask、偏移映射)。 +// 约定:复用方(暗场)相机名/通道名把 "dark" 替换为 "bright" 得到提供方(明场)的相机名/通道名, +// 同产品内按 (产品ID, 相机名, 通道名) 精确配对。 +// 生命周期:产品送图开始时清理(防上一轮的脏数据);产品检测完成时清理(释放内存)。 + */ +#ifndef AlignShare_H_ +#define AlignShare_H_ + +#include +#include +#include +#include +#include +#include "AI_Edge_Algin.h" + +class AlignShare +{ +public: + static AlignShare &GetInstance(); + + // 提供方(明场)定位成功:发布可复用的定位结果 + void PublishSuccess(const std::string &strProduct, const std::string &strCamera, const std::string &strChannel, + const std::shared_ptr &pResult, + const cv::Size &imgSize); + // 提供方(明场)定位失败:发布失败标记,让等待方立即走回退逻辑,不必干等超时 + void PublishFailed(const std::string &strProduct, const std::string &strCamera, const std::string &strChannel); + + // 查询(不等待):返回是否已有条目;bSucc 表示条目是成功结果(true)还是失败标记(false) + bool TryGet(const std::string &strProduct, const std::string &strCamera, const std::string &strChannel, + bool &bSucc, std::shared_ptr &pResult, cv::Size &imgSize); + + // 产品生命周期清理(送图开始 / 检测完成) + void ClearProduct(const std::string &strProduct); + +private: + AlignShare() {} + + struct AlignShareEntry_ + { + bool bSucc = false; // 条目是否代表"定位成功" + std::shared_ptr pResult; // 定位结果(成功时有效) + cv::Size imgSize = cv::Size(0, 0); // 结果对应的原图尺寸 + }; + + std::string MakeKey(const std::string &strProduct, const std::string &strCamera, const std::string &strChannel); + + std::map m_mapShare; // key: 产品ID|相机名|通道名 + std::mutex m_mtx; +}; + +#endif diff --git a/AlgorithmModule/include/Define_Base.h b/AlgorithmModule/include/Define_Base.h index 0aa55e8..10771ce 100644 --- a/AlgorithmModule/include/Define_Base.h +++ b/AlgorithmModule/include/Define_Base.h @@ -20,6 +20,16 @@ #define CHECK_CPU_BAND_START 15 #define CHECK_CPU_BAND_NUM 8 +// ============== 暗场相机复用明场相机的定位结果 ============== +// 相机名/通道名含 "dark" 的相机不做定位模型(Align_Outer/Align_Inner/Tag_Loc), +// 把 "dark" 替换为 "bright" 得到提供方(明场)的相机名/通道名,同产品内精确配对复用其定位结果。 +// 复用等待有超时上限;明场定位失败/超时/无明场图时,暗场回退为自行定位(与旧流程一致)。 +#define ALIGN_REUSE_ENABLE 1 // 0=关闭复用(全部相机自行定位) +#define ALIGN_REUSE_FOLLOWER_KEY "dark" // 复用方(暗场)关键字 +#define ALIGN_REUSE_SOURCE_KEY "bright" // 提供方(明场)关键字 +#define ALIGN_REUSE_WAIT_TIMEOUT_MS 5000 // 等待明场定位结果的超时(毫秒) +#define ALIGN_REUSE_POLL_MS 20 // 等待轮询间隔(毫秒) + // 相机ID 的相关定义 enum Camera_IDX { diff --git a/AlgorithmModule/include/ImageDetConfig.h b/AlgorithmModule/include/ImageDetConfig.h index 679709f..11e048c 100644 --- a/AlgorithmModule/include/ImageDetConfig.h +++ b/AlgorithmModule/include/ImageDetConfig.h @@ -4,6 +4,9 @@ #define _ImageDetConfig_HPP_ #include +#include +#include +#include #include #include "ImgCheckConfig.h" #include "CheckErrorCodeDefine.hpp" @@ -281,11 +284,37 @@ struct Align_Result printf("scale x %f y %f ,offt x %d y %d\n", fCropROI_Scale_ParmToDet_X, fCropROI_Scale_ParmToDet_Y, offt_x, offt_y); } }; +// 送图状态(同一产品的所有相机共享):供"暗场等待明场定位结果"判断源图是否还会到来 +struct AlignPushState +{ + std::mutex mtx; + bool bPushEnd = false; // 本产品所有图片是否已送完 + std::set cameraImgSet; // 已有图的相机名 + + void AddCameraImg(const std::string &strCam) + { + std::lock_guard lock(mtx); + cameraImgSet.insert(strCam); + } + void SetPushEnd() + { + std::lock_guard lock(mtx); + bPushEnd = true; + } + // 该相机的图是否还有可能到来:送图未结束,或送图结束时该相机已有图 + bool MayStillCome(const std::string &strCam) + { + std::lock_guard lock(mtx); + return (!bPushEnd) || (cameraImgSet.count(strCam) > 0); + } +}; + // 产品相关的 基础检测结果 struct ProductBaseResult { std::string strproductName = ""; // 产品 ID std::shared_ptr detlog; + std::shared_ptr alignPushState = std::make_shared(); // 送图状态(暗场复用明场定位用) }; // 相机相关的 基础检测结果 struct CameraBaseResult diff --git a/AlgorithmModule/include/ImgCheckAnalysisy.hpp b/AlgorithmModule/include/ImgCheckAnalysisy.hpp index 842c7fe..1fd448a 100644 --- a/AlgorithmModule/include/ImgCheckAnalysisy.hpp +++ b/AlgorithmModule/include/ImgCheckAnalysisy.hpp @@ -149,6 +149,13 @@ private: // 检测 int CheckRun(); int AI_Edge(const cv::Mat &img, cv::RotatedRect &outerRoi, cv::RotatedRect &innerRoi, std::vector &tagroiList); + // ===== 暗场复用明场定位结果(见 Define_Base.h 的 ALIGN_REUSE_* 配置) ===== + // 取当前图的产品ID/相机名(优先 productBaseResult/cameraBaseResult,兕底送图信息) + void GetProductCameraStr(std::string &strProduct, std::string &strCamera); + // 判断并在需要时等待"源相机(明场)"的定位结果;成功返回 true(结果已装入成员变量) + bool TryReuseAlignFromSource(std::string &strSrcCamera, std::string &strSrcChannel, int &nWaitMs); + // 发布本图定位结果/失败标记(供同产品其它相机复用) + void PublishAlignShare(bool bSucc); // 用 bigmask 检测把手(bigmask 主体近似矩形,把手是四周凸起的矩形块) int CheckHandleByBigMask(const cv::Mat &img, const cv::Mat &bigmask); // 在某个把手区域附近找宽高匹配的凸起:返回凸起在 candList 中的下标(-1=没找到) diff --git a/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp b/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp index 049a690..1cc3ae8 100644 --- a/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp +++ b/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp @@ -10,6 +10,7 @@ #include "CheckUtil.hpp" #include "Define.h" #include "AI_Factory.h" +#include "AlignShare.h" #include double calculateDistanceBetweenRectCenters(const cv::Rect &rect1, const cv::Rect &rect2, float fx, float fy) @@ -644,6 +645,8 @@ int ALLImgCheckAnalysisy::PushInImg_New(std::shared_ptr p) } product = std::make_shared(); product->productBaseResult->strproductName = p->strImgProductID; + // 新产品周期开始:清理上一轮可能残留的定位共享数据(暗场复用明场定位用) + AlignShare::GetInstance().ClearProduct(p->strImgProductID); m_ProductList.push_back(product); std::string strTimg = CheckUtil::getCurTimeHMS(); product->productBaseResult->detlog->AddCheckstr(PrintLevel_0, "PushInImg", "add new product %s %s ", p->strImgProductID.c_str(), strTimg.c_str()); @@ -661,8 +664,21 @@ int ALLImgCheckAnalysisy::PushInImg_New(std::shared_ptr p) } // 添加产品信息 pCamera->AddDetImage(p); + // 记录"该相机本产品已有图"(暗场等待明场定位时判断源图是否还会来) + if (product->productBaseResult->alignPushState) + { + product->productBaseResult->alignPushState->AddCameraImg(strcameraName); + } } product->UpdatePushStatus(p->Status); + // 送图结束:标记该产品不再有新图(暗场等待逻辑据此判断"源图不会再来了") + if (-1 == p->Status || IN_IMG_Status_End == p->Status || IN_IMG_Status_OneImg == p->Status) + { + if (product->productBaseResult->alignPushState) + { + product->productBaseResult->alignPushState->SetPushEnd(); + } + } if (-1 == p->Status || IN_IMG_Status_End == p->Status) { m_strTest += "\n"; @@ -694,6 +710,12 @@ int ALLImgCheckAnalysisy::Run() // } SetSetComplet_New(product, re); + // 产品检测完成:清理定位共享数据(暗场复用明场定位用) + if (product && product->productBaseResult) + { + AlignShare::GetInstance().ClearProduct(product->productBaseResult->strproductName); + } + // 更新 产品队列 { std::lock_guard lock(mtx_ProductList); // diff --git a/AlgorithmModule/src/AlignShare.cpp b/AlgorithmModule/src/AlignShare.cpp new file mode 100644 index 0000000..ebca595 --- /dev/null +++ b/AlgorithmModule/src/AlignShare.cpp @@ -0,0 +1,72 @@ +#include "AlignShare.h" + +AlignShare &AlignShare::GetInstance() +{ + static AlignShare s_instance; + return s_instance; +} + +std::string AlignShare::MakeKey(const std::string &strProduct, const std::string &strCamera, const std::string &strChannel) +{ + return strProduct + "|" + strCamera + "|" + strChannel; +} + +void AlignShare::PublishSuccess(const std::string &strProduct, const std::string &strCamera, const std::string &strChannel, + const std::shared_ptr &pResult, + const cv::Size &imgSize) +{ + if (!pResult) + { + return; + } + std::lock_guard lock(m_mtx); + AlignShareEntry_ &entry = m_mapShare[MakeKey(strProduct, strCamera, strChannel)]; + entry.bSucc = true; + entry.pResult = pResult; + entry.imgSize = imgSize; +} + +void AlignShare::PublishFailed(const std::string &strProduct, const std::string &strCamera, const std::string &strChannel) +{ + std::lock_guard lock(m_mtx); + AlignShareEntry_ &entry = m_mapShare[MakeKey(strProduct, strCamera, strChannel)]; + // 已有成功结果时不覆盖(同一图只会发布一次,正常不会走到) + if (entry.bSucc) + { + return; + } + entry.bSucc = false; + entry.pResult.reset(); +} + +bool AlignShare::TryGet(const std::string &strProduct, const std::string &strCamera, const std::string &strChannel, + bool &bSucc, std::shared_ptr &pResult, cv::Size &imgSize) +{ + std::lock_guard lock(m_mtx); + auto it = m_mapShare.find(MakeKey(strProduct, strCamera, strChannel)); + if (it == m_mapShare.end()) + { + return false; + } + bSucc = it->second.bSucc; + pResult = it->second.pResult; + imgSize = it->second.imgSize; + return true; +} + +void AlignShare::ClearProduct(const std::string &strProduct) +{ + std::lock_guard lock(m_mtx); + const std::string strPrefix = strProduct + "|"; + for (auto it = m_mapShare.begin(); it != m_mapShare.end();) + { + if (it->first.compare(0, strPrefix.size(), strPrefix) == 0) + { + it = m_mapShare.erase(it); + } + else + { + ++it; + } + } +} diff --git a/AlgorithmModule/src/ImgCheckAnalysisy.cpp b/AlgorithmModule/src/ImgCheckAnalysisy.cpp index b0223fd..80d10a5 100644 --- a/AlgorithmModule/src/ImgCheckAnalysisy.cpp +++ b/AlgorithmModule/src/ImgCheckAnalysisy.cpp @@ -11,7 +11,9 @@ #include "Define.h" #include #include "AICommonDefine.h" +#include "AlignShare.h" #include +#include // 把手判定参数: // 每个非空的"把手区域"附近都应该有一个把手:凸起宽高与该区域外接矩形宽高的比值落在下面范围内才算匹配 @@ -537,6 +539,193 @@ static void WarpAffineBandParallel(const cv::Mat &src, cv::Mat &dst, const cv::M } } +// 暗场复用明场定位:把字符串里的 "dark"(大小写不敏感)替换为 "bright";未命中返回空串 +static std::string ReplaceDarkWithBright(const std::string &strIn) +{ + const std::string strKey = ALIGN_REUSE_FOLLOWER_KEY; // "dark" + const std::string strSrc = ALIGN_REUSE_SOURCE_KEY; // "bright" + if (strIn.size() < strKey.size()) + { + return ""; + } + for (size_t i = 0; i + strKey.size() <= strIn.size(); i++) + { + size_t k = 0; + for (; k < strKey.size(); k++) + { + if (::tolower((unsigned char)strIn[i + k]) != (unsigned char)strKey[k]) + { + break; + } + } + if (k == strKey.size()) + { + std::string strOut = strIn; + strOut.replace(i, strKey.size(), strSrc); + return strOut; + } + } + return ""; +} + +// ===== 暗场复用明场定位结果(ALIGN_REUSE_* 配置) ===== +// 取当前图的产品ID/相机名:优先用 ImageAllResult 关联的基础结果,兕底用送图信息 +void ImgCheckAnalysisy::GetProductCameraStr(std::string &strProduct, std::string &strCamera) +{ + strProduct = ""; + strCamera = ""; + if (m_pImageAllResult) + { + if (m_pImageAllResult->productBaseResult) + { + strProduct = m_pImageAllResult->productBaseResult->strproductName; + } + if (m_pImageAllResult->cameraBaseResult) + { + strCamera = m_pImageAllResult->cameraBaseResult->strCameraName; + } + } + if (m_CheckResult_shareP && m_CheckResult_shareP->in_shareImage) + { + if (strProduct.empty()) + { + strProduct = m_CheckResult_shareP->in_shareImage->strImgProductID; + } + if (strCamera.empty()) + { + strCamera = m_CheckResult_shareP->in_shareImage->strCameraName; + } + } +} + +// 发布本图定位结果(成功)或失败标记(供同产品其它相机复用) +void ImgCheckAnalysisy::PublishAlignShare(bool bSucc) +{ + std::string strProduct; + std::string strCamera; + GetProductCameraStr(strProduct, strCamera); + if (strProduct.empty() || strCamera.empty()) + { + return; + } + if (bSucc) + { + if (!m_pEdge_Align_Result) + { + return; + } + cv::Size sz(0, 0); + if (m_CheckResult_shareP && m_CheckResult_shareP->in_shareImage) + { + sz = m_CheckResult_shareP->in_shareImage->img.size(); + } + AlignShare::GetInstance().PublishSuccess(strProduct, strCamera, m_strCurDetChannel, m_pEdge_Align_Result, sz); + } + else + { + AlignShare::GetInstance().PublishFailed(strProduct, strCamera, m_strCurDetChannel); + } +} + +// 暗场相机不做定位模型:等待并复用明场相机的定位结果 +// 返回 true 时:m_pEdge_Align_Result / m_outer_rroi / m_inner_rroi / m_tag_roiList 已用明场结果填充 +// 返回 false:非复用相机,或复用失败(超时/源失败/无源图/尺寸不一致),调用方走自有定位 +bool ImgCheckAnalysisy::TryReuseAlignFromSource(std::string &strSrcCamera, std::string &strSrcChannel, int &nWaitMs) +{ + nWaitMs = -1; +#if !ALIGN_REUSE_ENABLE + return false; +#else + std::string strProduct; + std::string strCamera; + GetProductCameraStr(strProduct, strCamera); + + // 相机名/通道名都要能按 dark->bright 替换,否则本相机不在复用规则内 + std::string strSrcCam = ReplaceDarkWithBright(strCamera); + std::string strSrcChn = ReplaceDarkWithBright(m_strCurDetChannel); + if (strSrcCam.empty() || strSrcChn.empty()) + { + return false; + } + strSrcCamera = strSrcCam; + strSrcChannel = strSrcChn; + + if (!m_pImageAllResult || !m_pImageAllResult->productBaseResult || !m_pImageAllResult->productBaseResult->alignPushState) + { + m_pdetlog->AddCheckstr(PrintLevel_0, "Align reuse", "reuse from %s|%s failed(no push state), do align by self", strSrcCam.c_str(), strSrcChn.c_str()); + return false; + } + + m_pdetlog->AddCheckstr(PrintLevel_0, "Align reuse", "wait %s|%s (timeout %d ms)", strSrcCam.c_str(), strSrcChn.c_str(), ALIGN_REUSE_WAIT_TIMEOUT_MS); + + AlignShare &alignShare = AlignShare::GetInstance(); + std::shared_ptr pSrc; + cv::Size srcSize; + const long t1 = CheckUtil::getcurTime(); + bool bGot = false; + bool bSucc = false; + std::string strFailReason = "timeout"; + while (true) + { + if (alignShare.TryGet(strProduct, strSrcCam, strSrcChn, bSucc, pSrc, srcSize)) + { + bGot = true; + if (!bSucc) + { + strFailReason = "source align failed"; + } + break; + } + // 源图不会再来了(送图已结束,且源相机没有图):立即回退,不干等超时 + if (!m_pImageAllResult->productBaseResult->alignPushState->MayStillCome(strSrcCam)) + { + strFailReason = "no source image"; + break; + } + if (CheckUtil::getcurTime() - t1 > ALIGN_REUSE_WAIT_TIMEOUT_MS) + { + break; + } + std::this_thread::sleep_for(std::chrono::milliseconds(ALIGN_REUSE_POLL_MS)); + } + nWaitMs = (int)(CheckUtil::getcurTime() - t1); + + if (!bGot || !bSucc) + { + m_pdetlog->AddCheckstr(PrintLevel_0, "Align reuse", "reuse from %s|%s failed(wait %d ms, %s), do align by self", + strSrcCam.c_str(), strSrcChn.c_str(), nWaitMs, strFailReason.c_str()); + return false; + } + if (!pSrc || pSrc->bigroi.empty()) + { + m_pdetlog->AddCheckstr(PrintLevel_0, "Align reuse", "reuse from %s|%s failed(wait %d ms, src roi empty), do align by self", + strSrcCam.c_str(), strSrcChn.c_str(), nWaitMs); + return false; + } + // 图像尺寸必须与源图一致,否则源坐标系不可用 + if (srcSize.width > 0 && srcSize.height > 0 && m_CheckResult_shareP && m_CheckResult_shareP->in_shareImage) + { + const cv::Mat &img = m_CheckResult_shareP->in_shareImage->img; + if (img.cols != srcSize.width || img.rows != srcSize.height) + { + m_pdetlog->AddCheckstr(PrintLevel_0, "Align reuse", "reuse from %s|%s failed, size %dx%d != cur %dx%d, do align by self", + strSrcCam.c_str(), strSrcChn.c_str(), srcSize.width, srcSize.height, img.cols, img.rows); + return false; + } + } + + // 复用明场定位结果:ROI/掩码/映射都用明场的 + m_pEdge_Align_Result = pSrc; + m_outer_rroi = pSrc->bigroi[0]; + if (!pSrc->smallroi.empty()) + { + m_inner_rroi = pSrc->smallroi[0]; + } + m_tag_roiList = pSrc->tagroi; // 直接赋值:明场没有标签时清空(避免沿用上一张的标签) + return true; +#endif +} + int ImgCheckAnalysisy::CheckRun() { @@ -574,6 +763,7 @@ int ImgCheckAnalysisy::CheckRun() if (rec != CHECK_OK) { m_pdetlog->AddCheckstr(PrintLevel_0, "Error", "ConfigCheck is error type = %d", rec); + PublishAlignShare(false); // 本图不会产出定位结果,通知可能的等待方(暗场复用) m_nErrorCode = rec; m_nCheckResultErrorCode = m_nErrorCode; return m_nErrorCode; @@ -591,23 +781,51 @@ int ImgCheckAnalysisy::CheckRun() { nfunction = 1; m_pdetlog->AddCheckstr(PrintLevel_0, "Error", "m_pFuntion is NULL"); + PublishAlignShare(false); // 本图不会产出定位结果,通知可能的等待方(暗场复用) m_nErrorCode = 22; m_nCheckResultErrorCode = m_nErrorCode; return m_nErrorCode; } /*AI 边缘定位(内外边缘)*/ - // 模型定位内外边缘 - int reedge = AI_Edge(m_CheckResult_shareP->in_shareImage->img, m_outer_rroi, m_inner_rroi, m_tag_roiList); - if (reedge != 0) + // 暗场相机不做定位模型,等待复用明场相机的定位结果(见 ALIGN_REUSE_* 配置); + // 非复用相机、或复用失败(源超时/源失败/无源图/尺寸不一致)时,仍走原有定位流程 + int reedge = 0; + int nAlignReuseWaitMs = -1; + std::string strAlignSrcCamera; + std::string strAlignSrcChannel; + long time_edge_e; + if (TryReuseAlignFromSource(strAlignSrcCamera, strAlignSrcChannel, nAlignReuseWaitMs)) + { + // 复用成功:m_pEdge_Align_Result / m_outer_rroi / m_inner_rroi / m_tag_roiList 已用明场结果填充 + PublishAlignShare(true); + time_edge_e = CheckUtil::getcurTime(); + m_pdetlog->AddCheckstr(PrintLevel_0, "2、pre detect", + "-------------------AI_Edge reuse from %s|%s--wait %d ms----succ---time %ld----\n", + strAlignSrcCamera.c_str(), strAlignSrcChannel.c_str(), nAlignReuseWaitMs, time_edge_e - time_edge_s); + // 定位模型不跑,但把手检测仍要执行:暗场图像 + 明场 bigmask + { + long handle_s = CheckUtil::getcurTime(); + CheckHandleByBigMask(m_CheckResult_shareP->in_shareImage->img, m_pEdge_Align_Result->bigmask); + long handle_e = CheckUtil::getcurTime(); + m_pdetlog->AddCheckstr(PrintLevel_1, DET_LOG_LEVEL_3, "Handle", "handle detect use time %ld", handle_e - handle_s); + } + } + else { - m_pdetlog->AddCheckstr(PrintLevel_0, "Error", "AI_Edge is error type = %d", reedge); - m_nErrorCode = reedge; - m_nCheckResultErrorCode = m_nErrorCode; - return m_nErrorCode; + reedge = AI_Edge(m_CheckResult_shareP->in_shareImage->img, m_outer_rroi, m_inner_rroi, m_tag_roiList); + if (reedge != 0) + { + m_pdetlog->AddCheckstr(PrintLevel_0, "Error", "AI_Edge is error type = %d", reedge); + PublishAlignShare(false); // 定位失败:通知可能的等待方(暗场复用),让其回退自行定位 + m_nErrorCode = reedge; + m_nCheckResultErrorCode = m_nErrorCode; + return m_nErrorCode; + } + PublishAlignShare(true); + time_edge_e = CheckUtil::getcurTime(); + m_pdetlog->AddCheckstr(PrintLevel_0, "2、pre detect", "-------------------------AI_Edge------------succ---time %ld----\n", time_edge_e - time_edge_s); } - long time_edge_e = CheckUtil::getcurTime(); - m_pdetlog->AddCheckstr(PrintLevel_0, "2、pre detect", "-------------------------AI_Edge------------succ---time %ld----\n", time_edge_e - time_edge_s); /*生成检测图:用 m_outer_rroi(旋转矩形)确定产品区域,并把该区域旋转摆正后输出; 原图坐标 -> 检测图坐标 的映射存入 m_matSrc2Det / m_matDet2Src,后续坐标换算都走这对矩阵*/