feat 添加支架,标签开关

dev_lsy
liusiyang 4 weeks ago
parent b7b8c100ef
commit e0913f2ac7

@ -107,6 +107,7 @@ public:
int nAIErodesize; // 边缘腐蚀强度
bool bSaveResultImg; // 保存结果图片
SaveProcessType saveProcessImg; // 保存过程图片
bool bDetTag; // 标签检测开关(关闭时不跑 Tag_Loc 模型)
bool bUseDrawRoi_Check; // 是否用绘制的ROI进行校验
cv::Rect drawRoi; // 绘制的 ROi;
cv::Mat drawMask; // 绘制的maksk
@ -122,6 +123,7 @@ public:
nAIErodesize = 7;
bSaveResultImg = false;
saveProcessImg = Save_Close;
bDetTag = true;
bUseDrawRoi_Check = false;
drawRoi = cv::Rect(0, 0, 0, 0);
if (!drawMask.empty())

@ -248,7 +248,14 @@ int AI_Edge_Algin::Detect(const cv::Mat &img, DetConfig *pDetConfig, std::shared
re0 = Get_Edge(0, img, pDetConfig, m_pDetConfig->strChannel, Big_roi, Big_outimg, true);
cv::Mat Big_outimg_src = img(Big_roi[0].boundingRect());
vecThreads.emplace_back([&]() { re1 = Get_Edge(1, Big_outimg_src, pDetConfig, m_pDetConfig->strChannel, Small_roi, Small_outimg, false); });
if (pDetConfig->bDetTag)
{
vecThreads.emplace_back([&]() { re2 = Get_Edge(2, Big_outimg_src, pDetConfig, m_pDetConfig->strChannel, Tag_roi, Tag_outimg, false); });
}
else
{
m_pdetlog->AddCheckstr(PrintLevel_2, DET_LOG_LEVEL_3, "AI_Edge_Algin ", "bDetTag close, skip Tag_Loc");
}
for (auto &t : vecThreads)
{
t.join();

@ -815,7 +815,9 @@ int ImgCheckAnalysisy::CheckRun()
long handle_e = CheckUtil::getcurTime();
m_pdetlog->AddCheckstr(PrintLevel_1, DET_LOG_LEVEL_3, "Handle", "handle detect use time %ld", handle_e - handle_s);
}
// 标签检测(独立步骤):暗场图像 + 明场 bigmask(不再沿用明场检出的标签)
// 标签检测(独立步骤):暗场图像 + 明场 bigmask(不再沿用明场检出的标签);bDetTag 关闭时跳过
{
if (m_pFuntion->function.f_supportDet.bDetTag)
{
long tag_s = CheckUtil::getcurTime();
int reTag = CheckTagByBigMask(m_CheckResult_shareP->in_shareImage->img, m_pEdge_Align_Result->bigmask);
@ -829,6 +831,12 @@ int ImgCheckAnalysisy::CheckRun()
return m_nErrorCode;
}
}
else
{
m_tag_roiList.clear();
m_pdetlog->AddCheckstr(PrintLevel_1, DET_LOG_LEVEL_3, "Tag", "bDetTag close, skip tag detect");
}
}
}
else
{
@ -949,10 +957,11 @@ int ImgCheckAnalysisy::CheckRun()
m_pdetlog->AddCheckstr(PrintLevel_0, "3、pre detect", "-------------------------pre Det--------------- \n");
/* 检测支架偏移 */
/* 检测支架偏移(bDetSupport 开关关闭时不做支架判定) */
{
Function_Support_Det &supportDet = m_pFuntion->function.f_supportDet;
if (supportDet.bOpen && supportDet.supportRect.size.width > 0 && supportDet.supportRect.size.height > 0)
if (supportDet.bOpen && supportDet.bDetSupport &&
supportDet.supportRect.size.width > 0 && supportDet.supportRect.size.height > 0)
{
cv::RotatedRect &inner = m_inner_rroi;
cv::RotatedRect &support = supportDet.supportRect;
@ -1089,8 +1098,12 @@ int ImgCheckAnalysisy::CheckRun()
}
}
/* Tag检测 */
/* Tag检测(bDetTag 关闭时不上报标签 NG) */
{
if (!m_pFuntion->function.f_supportDet.bDetTag)
{
m_tag_roiList.clear();
}
for (const auto &tagRoi : m_tag_roiList)
{
// tag roi 在原图坐标系,按摆正仿射转换到检测图(detImg)坐标系
@ -2529,6 +2542,7 @@ int ImgCheckAnalysisy::AI_Edge(const cv::Mat &img, cv::RotatedRect &outerRoi, cv
}
config.strChannel = DetImgInfo_shareP->strChannel;
config.pBaseCheckFunction = m_pbaseCheckFunction;
config.bDetTag = m_pFuntion->function.f_supportDet.bDetTag; // 标签检测开关:关闭时不跑 Tag_Loc
/* 定位获取三个roi */
int re = m_pAI_Edge_Algin.Detect(img, &config, m_pEdge_Align_Result);
@ -2544,10 +2558,8 @@ int ImgCheckAnalysisy::AI_Edge(const cv::Mat &img, cv::RotatedRect &outerRoi, cv
{
innerRoi = m_pEdge_Align_Result->smallroi[0];
}
if (!m_pEdge_Align_Result->tagroi.empty())
{
// 无条件赋值:Tag_Loc 未检出或 bDetTag 关闭(tagroi 为空)时清空,避免残留上一张图的标签
tagroiList = m_pEdge_Align_Result->tagroi;
}
/*使用m_pEdge_Align_Result->bigmask检测把手是否缺失*/
{

Loading…
Cancel
Save