|
|
|
|
@ -1144,7 +1144,6 @@ int QX_Merge_Analysis::Analysis_AD_Bind(ALL_Qx_DataList *pALLTypeqxList, int qx_
|
|
|
|
|
|
|
|
|
|
Base_Function_AD_Check *pAd_checkParma = &m_pbaseCheckFunction->ad_check;
|
|
|
|
|
|
|
|
|
|
int product_AD_num = 0; // 整个产品的 暗点数目。
|
|
|
|
|
int check_s_Num = 0;
|
|
|
|
|
int s_param_value = -1;
|
|
|
|
|
int s_param_num = 0;
|
|
|
|
|
@ -1169,6 +1168,7 @@ int QX_Merge_Analysis::Analysis_AD_Bind(ALL_Qx_DataList *pALLTypeqxList, int qx_
|
|
|
|
|
pAd_checkParma->bOpen, bana_num, bana_dis, bana_S);
|
|
|
|
|
|
|
|
|
|
/* 获取绑定通道 */
|
|
|
|
|
vector<string> merge_analysy_s_sf = pAd_checkParma->analysis_sf.s_sf;
|
|
|
|
|
vector<string> main_channel_2s = pAd_checkParma->analysis_bind.main_channel_2s;
|
|
|
|
|
vector<string> second_channel_2s = pAd_checkParma->analysis_bind.second_channel_2s;
|
|
|
|
|
vector<string> main_channel_3s = pAd_checkParma->analysis_bind.main_channel_3s;
|
|
|
|
|
@ -1303,20 +1303,24 @@ int QX_Merge_Analysis::Analysis_AD_Bind(ALL_Qx_DataList *pALLTypeqxList, int qx_
|
|
|
|
|
cv::Rect roi_second = pQXChannelList_second->qxList[j_second].product_roi;
|
|
|
|
|
roi_second = cv::Rect(roi_second.x - roi_expand, roi_second.y - roi_expand, roi_second.width + roi_expand * 2, roi_second.height + roi_expand * 2);
|
|
|
|
|
float fiou = CheckUtil::CalIoU(roi_main, roi_second);
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_3, 3, "CalIoU",
|
|
|
|
|
"roi1 %s roi2 %s expand %d iou %f",
|
|
|
|
|
CheckUtil::GetRectString(roi_main).c_str(),
|
|
|
|
|
CheckUtil::GetRectString(roi_second).c_str(),
|
|
|
|
|
roi_expand, fiou);
|
|
|
|
|
// m_pMergedetlog->AddCheckstr(PrintLevel_3, 3, "CalIoU",
|
|
|
|
|
// "roi1 %s roi2 %s expand %d iou %f",
|
|
|
|
|
// CheckUtil::GetRectString(roi_main).c_str(),
|
|
|
|
|
// CheckUtil::GetRectString(roi_second).c_str(),
|
|
|
|
|
// roi_expand, fiou);
|
|
|
|
|
if (fiou > pAd_checkParma->analysis_iou.AD_IOU)
|
|
|
|
|
{
|
|
|
|
|
if (std::find(second_channel_2s.begin(), second_channel_2s.end(), second_channel_name) != second_channel_2s.end())
|
|
|
|
|
{
|
|
|
|
|
tmp_main_qxInfo.s_name_2.push_back(second_channel_name);
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_3, 3, "Add 2s", "%s roi1 %s roi2 %s expand %d iou %f",
|
|
|
|
|
second_channel_name.c_str(), CheckUtil::GetRectString(roi_main).c_str(),CheckUtil::GetRectString(roi_second).c_str(),roi_expand, fiou);
|
|
|
|
|
}
|
|
|
|
|
if(std::find(second_channel_3s.begin(), second_channel_3s.end(), second_channel_name) != second_channel_3s.end())
|
|
|
|
|
{
|
|
|
|
|
tmp_main_qxInfo.s_name_3.push_back(second_channel_name);
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_3, 3, "Add 3s", "%s roi1 %s roi2 %s expand %d iou %f",
|
|
|
|
|
second_channel_name.c_str(), CheckUtil::GetRectString(roi_main).c_str(),CheckUtil::GetRectString(roi_second).c_str(),roi_expand, fiou);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
@ -1334,13 +1338,11 @@ int QX_Merge_Analysis::Analysis_AD_Bind(ALL_Qx_DataList *pALLTypeqxList, int qx_
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 数量距离统计 */
|
|
|
|
|
int num_1s = 0;
|
|
|
|
|
int num_2s = 0;
|
|
|
|
|
int num_3s = 0;
|
|
|
|
|
float min_dis = 9999999999;
|
|
|
|
|
std::unordered_map<string, AD_Channel_Stat_> AD_stat_map;
|
|
|
|
|
for(int i_main = 0; i_main < main_channel_s_qxList.size(); i_main++)
|
|
|
|
|
{
|
|
|
|
|
string main_channel_name = main_channel_s_qxList[i_main].channel_name;
|
|
|
|
|
AD_Channel_Stat_ &stat = AD_stat_map[main_channel_name];
|
|
|
|
|
for(int j = 0; j < AD_list_bind[main_channel_name].size(); j++)
|
|
|
|
|
{
|
|
|
|
|
bool bproduct_AD_num = false;
|
|
|
|
|
@ -1348,36 +1350,40 @@ int QX_Merge_Analysis::Analysis_AD_Bind(ALL_Qx_DataList *pALLTypeqxList, int qx_
|
|
|
|
|
if(AD_list_bind[main_channel_name][j].s_type == 1)
|
|
|
|
|
{
|
|
|
|
|
bproduct_AD_num = true;
|
|
|
|
|
num_1s++;
|
|
|
|
|
stat.num_1s++;
|
|
|
|
|
}
|
|
|
|
|
if(AD_list_bind[main_channel_name][j].s_type == 2 || AD_list_bind[main_channel_name][j].s_name_2.size() >= 2)
|
|
|
|
|
{
|
|
|
|
|
if(AD_list_bind[main_channel_name][j].s_type == 2) stat.num_2s_s++;
|
|
|
|
|
if(AD_list_bind[main_channel_name][j].s_name_2.size() >= 2) stat.num_2s_m++;
|
|
|
|
|
bproduct_AD_num = true;
|
|
|
|
|
num_2s++;
|
|
|
|
|
stat.num_2s++;
|
|
|
|
|
}
|
|
|
|
|
if(AD_list_bind[main_channel_name][j].s_type == 3 || AD_list_bind[main_channel_name][j].s_name_3.size() >= 3)
|
|
|
|
|
{
|
|
|
|
|
if(AD_list_bind[main_channel_name][j].s_type == 3) stat.num_3s_s++;
|
|
|
|
|
if(AD_list_bind[main_channel_name][j].s_name_3.size() >= 3) stat.num_3s_m++;
|
|
|
|
|
bproduct_AD_num = true;
|
|
|
|
|
num_3s++;
|
|
|
|
|
stat.num_3s++;
|
|
|
|
|
}
|
|
|
|
|
if(bproduct_AD_num)
|
|
|
|
|
{
|
|
|
|
|
product_AD_num++;
|
|
|
|
|
stat.product_AD_num++;
|
|
|
|
|
}
|
|
|
|
|
// 距离计算
|
|
|
|
|
for(int k = j + 1; k < AD_list_bind[main_channel_name].size(); k++)
|
|
|
|
|
{
|
|
|
|
|
float dis = CheckUtil::calDis(AD_list_bind[main_channel_name][j].location_product_mm, AD_list_bind[main_channel_name][k].location_product_mm);
|
|
|
|
|
if (dis < min_dis)
|
|
|
|
|
if (dis < stat.min_dis)
|
|
|
|
|
{
|
|
|
|
|
min_dis = dis;
|
|
|
|
|
}
|
|
|
|
|
stat.min_dis = dis;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_1, 3, "Analysis_AD_Bind", "stat num_1s %d num_2s %d num_3s %d product_AD_num %d min_dis %0.2f",
|
|
|
|
|
num_1s, num_2s, num_3s, product_AD_num, min_dis);
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_1, 3, "Analysis_AD_Bind", "stat %s num_1s %d | num_2s %d [s %d m %d] | num_3s %d [s %d m %d] | product_AD_num %d | min_dis %0.2f",
|
|
|
|
|
main_channel_name.c_str(), stat.num_1s, stat.num_2s, stat.num_2s_s, stat.num_2s_m, stat.num_3s, stat.num_3s_s, stat.num_3s_m, stat.product_AD_num, stat.min_dis);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* NG分析 */
|
|
|
|
|
for (int i = 0; i < pALLTypeqxList->channelqxList.size(); i++)
|
|
|
|
|
@ -1388,6 +1394,22 @@ int QX_Merge_Analysis::Analysis_AD_Bind(ALL_Qx_DataList *pALLTypeqxList, int qx_
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(std::find(merge_analysy_s_sf.begin(), merge_analysy_s_sf.end(), pQXChannelList->channel_name) != merge_analysy_s_sf.end())
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_1, 3, "Analysis_AD_Bind", "merge_analysy_s_sf not found %s --> skip", pQXChannelList->channel_name.c_str());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// 获取该通道独立的统计
|
|
|
|
|
auto it_stat = AD_stat_map.find(pQXChannelList->channel_name);
|
|
|
|
|
if (it_stat == AD_stat_map.end())
|
|
|
|
|
{
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_1, 3, "Analysis_AD_Bind", "AD_stat_map not found %s --> skip", pQXChannelList->channel_name.c_str());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
AD_Channel_Stat_ &stat = it_stat->second;
|
|
|
|
|
bool bNG = false;
|
|
|
|
|
|
|
|
|
|
bool NG_num = false;
|
|
|
|
|
@ -1398,17 +1420,17 @@ int QX_Merge_Analysis::Analysis_AD_Bind(ALL_Qx_DataList *pALLTypeqxList, int qx_
|
|
|
|
|
if (pAd_checkParma->analysis_num.bOpen)
|
|
|
|
|
{
|
|
|
|
|
// 数量分析
|
|
|
|
|
if (product_AD_num >= pAd_checkParma->analysis_num.numT)
|
|
|
|
|
if (stat.product_AD_num >= pAd_checkParma->analysis_num.numT)
|
|
|
|
|
{
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_2, 3, "AD RGBL255", "Num Analysis --> %s result NG ,product_AD_num %d >= parm num %d",
|
|
|
|
|
pQXChannelList->channel_name.c_str(), product_AD_num, pAd_checkParma->analysis_num.numT);
|
|
|
|
|
pQXChannelList->channel_name.c_str(), stat.product_AD_num, pAd_checkParma->analysis_num.numT);
|
|
|
|
|
bNG = true;
|
|
|
|
|
NG_num = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_2, 3, "AD RGBL255", "Num Analysis--> %s result OK ,product_AD_num %d < parm num %d",
|
|
|
|
|
pQXChannelList->channel_name.c_str(), product_AD_num, pAd_checkParma->analysis_num.numT);
|
|
|
|
|
pQXChannelList->channel_name.c_str(), stat.product_AD_num, pAd_checkParma->analysis_num.numT);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 不NG
|
|
|
|
|
@ -1417,17 +1439,17 @@ int QX_Merge_Analysis::Analysis_AD_Bind(ALL_Qx_DataList *pALLTypeqxList, int qx_
|
|
|
|
|
// 3S直接 NG
|
|
|
|
|
if (pAd_checkParma->analysis_s.NG_3s)
|
|
|
|
|
{
|
|
|
|
|
if (num_3s >= 1)
|
|
|
|
|
if (stat.num_3s >= 1)
|
|
|
|
|
{
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_2, 3, "AD RGBL255", "3S Analysis --> %s result NG 3S %d >= 1",
|
|
|
|
|
pQXChannelList->channel_name.c_str(), num_3s);
|
|
|
|
|
pQXChannelList->channel_name.c_str(), stat.num_3s);
|
|
|
|
|
bNG = true;
|
|
|
|
|
NG_3S = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_2, 3, "AD RGBL255", "3S Analysis --> %s result OK 3S %d < 1",
|
|
|
|
|
pQXChannelList->channel_name.c_str(), num_3s);
|
|
|
|
|
pQXChannelList->channel_name.c_str(), stat.num_3s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1437,17 +1459,17 @@ int QX_Merge_Analysis::Analysis_AD_Bind(ALL_Qx_DataList *pALLTypeqxList, int qx_
|
|
|
|
|
// 距离判断
|
|
|
|
|
if (pAd_checkParma->analysis_dis.bOpen)
|
|
|
|
|
{
|
|
|
|
|
if (min_dis <= pAd_checkParma->analysis_dis.disT)
|
|
|
|
|
if (stat.min_dis <= pAd_checkParma->analysis_dis.disT)
|
|
|
|
|
{
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_2, 3, "AD RGBL255", "Dis Analysis--> %s Dis result NG ,min dis %f <= parm dis %f",
|
|
|
|
|
pQXChannelList->channel_name.c_str(), min_dis, pAd_checkParma->analysis_dis.disT);
|
|
|
|
|
pQXChannelList->channel_name.c_str(), stat.min_dis, pAd_checkParma->analysis_dis.disT);
|
|
|
|
|
bNG = true;
|
|
|
|
|
NG_dis = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_2, 3, "AD RGBL255", "Dis Analysis--> %s Dis result OK ,min dis %f > parm dis %f",
|
|
|
|
|
pQXChannelList->channel_name.c_str(), min_dis, pAd_checkParma->analysis_dis.disT);
|
|
|
|
|
pQXChannelList->channel_name.c_str(), stat.min_dis, pAd_checkParma->analysis_dis.disT);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1457,17 +1479,17 @@ int QX_Merge_Analysis::Analysis_AD_Bind(ALL_Qx_DataList *pALLTypeqxList, int qx_
|
|
|
|
|
// S标准判断
|
|
|
|
|
if (pAd_checkParma->analysis_s.bOpen)
|
|
|
|
|
{
|
|
|
|
|
if (num_2s >= pAd_checkParma->analysis_s.Check_s_Num)
|
|
|
|
|
if (stat.num_2s >= pAd_checkParma->analysis_s.Check_s_Num)
|
|
|
|
|
{
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_2, 3, "AD RGBL255", "S Analysis--> %s result NG , Check %ds Num %d >= parm S Num %d",
|
|
|
|
|
pQXChannelList->channel_name.c_str(), pAd_checkParma->analysis_s.Check_s_Value, num_2s, pAd_checkParma->analysis_s.Check_s_Num);
|
|
|
|
|
pQXChannelList->channel_name.c_str(), pAd_checkParma->analysis_s.Check_s_Value, stat.num_2s, pAd_checkParma->analysis_s.Check_s_Num);
|
|
|
|
|
bNG = true;
|
|
|
|
|
NG_2S = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_pMergedetlog->AddCheckstr(PrintLevel_2, 3, "AD RGBL255", "S Analysis--> %s result OK , Check %ds Num %d < parm S Num %d",
|
|
|
|
|
pQXChannelList->channel_name.c_str(), pAd_checkParma->analysis_s.Check_s_Value, num_2s, pAd_checkParma->analysis_s.Check_s_Num);
|
|
|
|
|
pQXChannelList->channel_name.c_str(), pAd_checkParma->analysis_s.Check_s_Value, stat.num_2s, pAd_checkParma->analysis_s.Check_s_Num);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|