|
|
|
@ -407,7 +407,6 @@ struct BasicConfig
|
|
|
|
float Product_Size_Height_mm; // 产品尺寸 高度 mm
|
|
|
|
float Product_Size_Height_mm; // 产品尺寸 高度 mm
|
|
|
|
float fImage_Scale_x; // 成像精度
|
|
|
|
float fImage_Scale_x; // 成像精度
|
|
|
|
float fImage_Scale_y; // 成像精度
|
|
|
|
float fImage_Scale_y; // 成像精度
|
|
|
|
bool bTraditionalDetect; // 使用传统算法检测
|
|
|
|
|
|
|
|
std::string strCamName; //
|
|
|
|
std::string strCamName; //
|
|
|
|
|
|
|
|
|
|
|
|
float density_R_mm; // 密度计算半径 像素
|
|
|
|
float density_R_mm; // 密度计算半径 像素
|
|
|
|
@ -428,7 +427,6 @@ struct BasicConfig
|
|
|
|
Product_Size_Height_mm = 1000;
|
|
|
|
Product_Size_Height_mm = 1000;
|
|
|
|
fImage_Scale_x = 0.03;
|
|
|
|
fImage_Scale_x = 0.03;
|
|
|
|
fImage_Scale_y = 0.03;
|
|
|
|
fImage_Scale_y = 0.03;
|
|
|
|
bTraditionalDetect = false;
|
|
|
|
|
|
|
|
density_R_mm = 5;
|
|
|
|
density_R_mm = 5;
|
|
|
|
strCamName = "";
|
|
|
|
strCamName = "";
|
|
|
|
strCamearName = EMPTY_CONFIG_NAME;
|
|
|
|
strCamearName = EMPTY_CONFIG_NAME;
|
|
|
|
@ -452,7 +450,6 @@ struct BasicConfig
|
|
|
|
this->Product_Size_Height_mm = tem.Product_Size_Height_mm;
|
|
|
|
this->Product_Size_Height_mm = tem.Product_Size_Height_mm;
|
|
|
|
this->fImage_Scale_x = tem.fImage_Scale_x;
|
|
|
|
this->fImage_Scale_x = tem.fImage_Scale_x;
|
|
|
|
this->fImage_Scale_y = tem.fImage_Scale_y;
|
|
|
|
this->fImage_Scale_y = tem.fImage_Scale_y;
|
|
|
|
this->bTraditionalDetect = tem.bTraditionalDetect;
|
|
|
|
|
|
|
|
this->density_R_mm = tem.density_R_mm;
|
|
|
|
this->density_R_mm = tem.density_R_mm;
|
|
|
|
this->strCamearName = tem.strCamearName;
|
|
|
|
this->strCamearName = tem.strCamearName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -461,7 +458,7 @@ struct BasicConfig
|
|
|
|
printf("============================↓↓↓↓↓↓%s↓↓ %s ↓↓↓↓↓=========================\n", str.c_str(), strCamearName.c_str());
|
|
|
|
printf("============================↓↓↓↓↓↓%s↓↓ %s ↓↓↓↓↓=========================\n", str.c_str(), strCamearName.c_str());
|
|
|
|
printf("bCal_ImageScale %d Product_Size_Width =%f Product_Size_Height =%f \n", bCal_ImageScale, Product_Size_Width_mm, Product_Size_Height_mm);
|
|
|
|
printf("bCal_ImageScale %d Product_Size_Width =%f Product_Size_Height =%f \n", bCal_ImageScale, Product_Size_Width_mm, Product_Size_Height_mm);
|
|
|
|
printf("fImage_Scale_x =%f fImage_Scale_y=%f \n", fImage_Scale_x, fImage_Scale_y);
|
|
|
|
printf("fImage_Scale_x =%f fImage_Scale_y=%f \n", fImage_Scale_x, fImage_Scale_y);
|
|
|
|
printf("bTraditionalDetect %d density_R_mm=%f \n", bTraditionalDetect, density_R_mm);
|
|
|
|
printf("density_R_mm=%f \n", density_R_mm);
|
|
|
|
// printf("height_min =%d height_max=%d \n", height_min, height_max);
|
|
|
|
// printf("height_min =%d height_max=%d \n", height_min, height_max);
|
|
|
|
printf("bDrawShieldRoi %d bShield_ZF %d DrawPreRoi %d fUP_IOU %f density_R_mm %f\n", bDrawShieldRoi, bShield_ZF, bDrawPreRoi, fUP_IOU, density_R_mm);
|
|
|
|
printf("bDrawShieldRoi %d bShield_ZF %d DrawPreRoi %d fUP_IOU %f density_R_mm %f\n", bDrawShieldRoi, bShield_ZF, bDrawPreRoi, fUP_IOU, density_R_mm);
|
|
|
|
printf("============================↑↑↑↑↑↑%s↑↑↑↑↑↑=========================\n", str.c_str());
|
|
|
|
printf("============================↑↑↑↑↑↑%s↑↑↑↑↑↑=========================\n", str.c_str());
|
|
|
|
@ -1782,6 +1779,61 @@ struct Base_Function_SaveImg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//传统检测
|
|
|
|
|
|
|
|
struct Base_Function_TraditionDet
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
bool bOpen; // 是否开启
|
|
|
|
|
|
|
|
float nAreaLowFilter; // 定位阈值
|
|
|
|
|
|
|
|
int nBlockSize; // 分块大小
|
|
|
|
|
|
|
|
float fZoomRatio; // 缩放比例
|
|
|
|
|
|
|
|
float nAreaFilter; // 面积过滤
|
|
|
|
|
|
|
|
int nCountFilter; // 数量过滤
|
|
|
|
|
|
|
|
cv::Rect detArea_ROI;
|
|
|
|
|
|
|
|
std::vector<cv::Point> detArea;
|
|
|
|
|
|
|
|
bool bdetArea; // 是否使用区域
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Base_Function_TraditionDet()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Init();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Init()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
bOpen = false;
|
|
|
|
|
|
|
|
nAreaLowFilter = 0;
|
|
|
|
|
|
|
|
nBlockSize = 0;
|
|
|
|
|
|
|
|
fZoomRatio = 0;
|
|
|
|
|
|
|
|
nAreaFilter = 0;
|
|
|
|
|
|
|
|
nCountFilter = 0;
|
|
|
|
|
|
|
|
bdetArea = false;
|
|
|
|
|
|
|
|
detArea_ROI = cv::Rect(0, 0, 0, 0);
|
|
|
|
|
|
|
|
detArea.clear();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void copy(Base_Function_TraditionDet tem)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this->bOpen = tem.bOpen;
|
|
|
|
|
|
|
|
this->nAreaLowFilter = tem.nAreaLowFilter;
|
|
|
|
|
|
|
|
this->nBlockSize = tem.nBlockSize;
|
|
|
|
|
|
|
|
this->fZoomRatio = tem.fZoomRatio;
|
|
|
|
|
|
|
|
this->nAreaFilter = tem.nAreaFilter;
|
|
|
|
|
|
|
|
this->nCountFilter = tem.nCountFilter;
|
|
|
|
|
|
|
|
this->bdetArea = tem.bdetArea;
|
|
|
|
|
|
|
|
this->detArea_ROI = tem.detArea_ROI;
|
|
|
|
|
|
|
|
this->detArea.assign(tem.detArea.begin(), tem.detArea.end());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void print(std::string str)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("%s>>bOpen %d nAreaLowFilter %f nBlockSize %d fZoomRatio %f nAreaFilter %f nCountFilter %d \n", str.c_str(),
|
|
|
|
|
|
|
|
bOpen, nAreaLowFilter, nBlockSize, fZoomRatio, nAreaFilter, nCountFilter);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string GetInfo(std::string str)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
char buffer[256];
|
|
|
|
|
|
|
|
sprintf(buffer, "%s>>bOpen %d nAreaLowFilter %f nBlockSize %d fZoomRatio %f nAreaFilter %f nCountFilter %d \n", str.c_str(),
|
|
|
|
|
|
|
|
bOpen, nAreaLowFilter, nBlockSize, fZoomRatio, nAreaFilter, nCountFilter);
|
|
|
|
|
|
|
|
std::string str123 = buffer;
|
|
|
|
|
|
|
|
return str123;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
// 大缺陷 NG
|
|
|
|
// 大缺陷 NG
|
|
|
|
struct Big_NG
|
|
|
|
struct Big_NG
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -1970,6 +2022,7 @@ struct BaseCheckFunction
|
|
|
|
Base_Function_MarkLine markLine;
|
|
|
|
Base_Function_MarkLine markLine;
|
|
|
|
Base_Function_Edge_Det edgeDet;
|
|
|
|
Base_Function_Edge_Det edgeDet;
|
|
|
|
Base_Function_SaveImg saveImg;
|
|
|
|
Base_Function_SaveImg saveImg;
|
|
|
|
|
|
|
|
Base_Function_TraditionDet traditionDet;
|
|
|
|
Base_Function_BigNG bigNG;
|
|
|
|
Base_Function_BigNG bigNG;
|
|
|
|
BaseCheckFunction()
|
|
|
|
BaseCheckFunction()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -1980,6 +2033,7 @@ struct BaseCheckFunction
|
|
|
|
markLine.Init();
|
|
|
|
markLine.Init();
|
|
|
|
edgeDet.Init();
|
|
|
|
edgeDet.Init();
|
|
|
|
saveImg.Init();
|
|
|
|
saveImg.Init();
|
|
|
|
|
|
|
|
traditionDet.Init();
|
|
|
|
bigNG.Init();
|
|
|
|
bigNG.Init();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void copy(BaseCheckFunction tem)
|
|
|
|
void copy(BaseCheckFunction tem)
|
|
|
|
@ -1987,6 +2041,7 @@ struct BaseCheckFunction
|
|
|
|
this->markLine.copy(tem.markLine);
|
|
|
|
this->markLine.copy(tem.markLine);
|
|
|
|
this->edgeDet.copy(tem.edgeDet);
|
|
|
|
this->edgeDet.copy(tem.edgeDet);
|
|
|
|
this->saveImg.copy(tem.saveImg);
|
|
|
|
this->saveImg.copy(tem.saveImg);
|
|
|
|
|
|
|
|
this->traditionDet.copy(tem.traditionDet);
|
|
|
|
this->bigNG.copy(tem.bigNG);
|
|
|
|
this->bigNG.copy(tem.bigNG);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void print(std::string str)
|
|
|
|
void print(std::string str)
|
|
|
|
@ -1995,6 +2050,7 @@ struct BaseCheckFunction
|
|
|
|
markLine.print("markLine");
|
|
|
|
markLine.print("markLine");
|
|
|
|
edgeDet.print("edgeDet");
|
|
|
|
edgeDet.print("edgeDet");
|
|
|
|
saveImg.print("saveImg");
|
|
|
|
saveImg.print("saveImg");
|
|
|
|
|
|
|
|
traditionDet.print("traditionDet");
|
|
|
|
bigNG.print("bigNG");
|
|
|
|
bigNG.print("bigNG");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::string GetInfo(std::string str)
|
|
|
|
std::string GetInfo(std::string str)
|
|
|
|
@ -2003,6 +2059,7 @@ struct BaseCheckFunction
|
|
|
|
str123 += markLine.GetInfo("markLine");
|
|
|
|
str123 += markLine.GetInfo("markLine");
|
|
|
|
str123 += edgeDet.GetInfo("edgeDet");
|
|
|
|
str123 += edgeDet.GetInfo("edgeDet");
|
|
|
|
str123 += saveImg.GetInfo("saveImg");
|
|
|
|
str123 += saveImg.GetInfo("saveImg");
|
|
|
|
|
|
|
|
str123 += traditionDet.GetInfo("traditionDet");
|
|
|
|
str123 += bigNG.GetInfo("bigNG");
|
|
|
|
str123 += bigNG.GetInfo("bigNG");
|
|
|
|
// str123 += "\n";
|
|
|
|
// str123 += "\n";
|
|
|
|
return str123;
|
|
|
|
return str123;
|
|
|
|
|