|
|
|
|
@ -1018,52 +1018,44 @@ struct ChannelCheckFunction
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 基础检测功能 mark
|
|
|
|
|
struct Base_Function_MarkLine
|
|
|
|
|
struct Base_Function_ALign
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
bool bOpen; // 是否开启
|
|
|
|
|
bool bDraw; // 是否绘制
|
|
|
|
|
bool badapt_region; // 是否自适应区域
|
|
|
|
|
cv::Rect productROI;
|
|
|
|
|
std::vector<cv::Point> region;
|
|
|
|
|
cv::Point mark_local_1;
|
|
|
|
|
cv::Point mark_local_2;
|
|
|
|
|
float angle_diff;
|
|
|
|
|
float x_offset;
|
|
|
|
|
float y_offset;
|
|
|
|
|
|
|
|
|
|
Base_Function_MarkLine()
|
|
|
|
|
|
|
|
|
|
Base_Function_ALign()
|
|
|
|
|
{
|
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
void Init()
|
|
|
|
|
{
|
|
|
|
|
bOpen = false;
|
|
|
|
|
bDraw = false;
|
|
|
|
|
badapt_region = false;
|
|
|
|
|
mark_local_1 = cv::Point(0, 0);
|
|
|
|
|
mark_local_2 = cv::Point(0, 0);
|
|
|
|
|
productROI = cv::Rect(0, 0, 0, 0);
|
|
|
|
|
region.clear();
|
|
|
|
|
angle_diff = 0.0;
|
|
|
|
|
x_offset = 0.0;
|
|
|
|
|
y_offset = 0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void copy(Base_Function_MarkLine tem)
|
|
|
|
|
void copy(Base_Function_ALign tem)
|
|
|
|
|
{
|
|
|
|
|
this->bOpen = tem.bOpen;
|
|
|
|
|
this->region.assign(tem.region.begin(), tem.region.end());
|
|
|
|
|
this->productROI = tem.productROI;
|
|
|
|
|
this->bDraw = tem.bDraw;
|
|
|
|
|
this->badapt_region = tem.badapt_region;
|
|
|
|
|
this->mark_local_1 = tem.mark_local_1;
|
|
|
|
|
this->mark_local_2 = tem.mark_local_2;
|
|
|
|
|
this->angle_diff = tem.angle_diff;
|
|
|
|
|
this->x_offset = tem.x_offset;
|
|
|
|
|
this->y_offset = tem.y_offset;
|
|
|
|
|
}
|
|
|
|
|
void print(std::string str)
|
|
|
|
|
{
|
|
|
|
|
printf("%s>>bOpen %d bDraw %d badapt_region %d mark1 [%d %d] mark2 [%d %d] \n", str.c_str(),
|
|
|
|
|
bOpen, bDraw, badapt_region,mark_local_1.x, mark_local_1.y, mark_local_2.x, mark_local_2.y);
|
|
|
|
|
printf("%s>>bOpen %d angle_diff %f x_offset %f y_offset %f \n", str.c_str(),
|
|
|
|
|
bOpen, angle_diff, x_offset, y_offset);
|
|
|
|
|
}
|
|
|
|
|
std::string GetInfo(std::string str)
|
|
|
|
|
{
|
|
|
|
|
char buffer[256];
|
|
|
|
|
sprintf(buffer, "%s>>bOpen %d bDraw %d badapt_region %d mark1 [%d %d] mark2 [%d %d] \n", str.c_str(),
|
|
|
|
|
bOpen, bDraw, badapt_region,mark_local_1.x, mark_local_1.y, mark_local_2.x, mark_local_2.y);
|
|
|
|
|
sprintf(buffer, "%s>>bOpen %d angle_diff %f x_offset %f y_offset %f \n", str.c_str(),
|
|
|
|
|
bOpen, angle_diff, x_offset, y_offset);
|
|
|
|
|
std::string str123 = buffer;
|
|
|
|
|
return str123;
|
|
|
|
|
}
|
|
|
|
|
@ -1206,91 +1198,43 @@ struct Base_Function_BigNG
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
// 基础检测功能 CELL AOI 边缘缺陷检测
|
|
|
|
|
struct Base_Function_Edge_Det
|
|
|
|
|
struct Base_Function_Pin_Det
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
bool bOpen; // 是否开启
|
|
|
|
|
int Search_threshold; // 搜索边缘阈值
|
|
|
|
|
int Det_threshold; // 缺陷检测阈值
|
|
|
|
|
int Det_Range; // 检测范围
|
|
|
|
|
int QX_Widht_min; // 缺陷宽度-最小
|
|
|
|
|
int QX_Widht_max;
|
|
|
|
|
int QX_Height_min;
|
|
|
|
|
int QX_Height_max;
|
|
|
|
|
|
|
|
|
|
bool queJiao_LU_Open;
|
|
|
|
|
bool queJiao_RU_Open;
|
|
|
|
|
bool queJiao_LD_Open;
|
|
|
|
|
bool queJiao_RD_Open;
|
|
|
|
|
int queJiao_width;
|
|
|
|
|
int queJiao_height;
|
|
|
|
|
|
|
|
|
|
bool bDrawRoi;
|
|
|
|
|
cv::Rect draw_ROI;
|
|
|
|
|
std::vector<cv::Point> region;
|
|
|
|
|
|
|
|
|
|
bool bDrawResult; // 是否绘制结果
|
|
|
|
|
Base_Function_Edge_Det()
|
|
|
|
|
float pin_x_offset; // pin x 偏移
|
|
|
|
|
float pin_y_offset; // pin y 偏移
|
|
|
|
|
|
|
|
|
|
bool bDrawResult; // 是否绘制结果
|
|
|
|
|
Base_Function_Pin_Det()
|
|
|
|
|
{
|
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
void Init()
|
|
|
|
|
{
|
|
|
|
|
bOpen = false;
|
|
|
|
|
Search_threshold = 30;
|
|
|
|
|
Det_threshold = 30;
|
|
|
|
|
Det_Range = 100;
|
|
|
|
|
QX_Widht_min = 10;
|
|
|
|
|
QX_Widht_max = 100;
|
|
|
|
|
QX_Height_min = 10;
|
|
|
|
|
QX_Height_max = 100;
|
|
|
|
|
|
|
|
|
|
queJiao_LU_Open = false;
|
|
|
|
|
queJiao_RU_Open = false;
|
|
|
|
|
queJiao_LD_Open = false;
|
|
|
|
|
queJiao_RD_Open = false;
|
|
|
|
|
queJiao_width = 50;
|
|
|
|
|
queJiao_height = 50;
|
|
|
|
|
bDrawRoi = false;
|
|
|
|
|
draw_ROI = cv::Rect(0, 0, 0, 0);
|
|
|
|
|
region.clear();
|
|
|
|
|
region.erase(region.begin(), region.end());
|
|
|
|
|
pin_x_offset = 0;
|
|
|
|
|
pin_y_offset = 0;
|
|
|
|
|
bDrawResult = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void copy(Base_Function_Edge_Det tem)
|
|
|
|
|
void copy(Base_Function_Pin_Det tem)
|
|
|
|
|
{
|
|
|
|
|
this->bOpen = tem.bOpen;
|
|
|
|
|
this->Search_threshold = tem.Search_threshold;
|
|
|
|
|
this->Det_threshold = tem.Det_threshold;
|
|
|
|
|
this->Det_Range = tem.Det_Range;
|
|
|
|
|
this->QX_Widht_min = tem.QX_Widht_min;
|
|
|
|
|
this->QX_Widht_max = tem.QX_Widht_max;
|
|
|
|
|
this->QX_Height_min = tem.QX_Height_min;
|
|
|
|
|
this->QX_Height_max = tem.QX_Height_max;
|
|
|
|
|
|
|
|
|
|
this->queJiao_LU_Open = tem.queJiao_LU_Open;
|
|
|
|
|
this->queJiao_RU_Open = tem.queJiao_RU_Open;
|
|
|
|
|
this->queJiao_LD_Open = tem.queJiao_LD_Open;
|
|
|
|
|
this->queJiao_RD_Open = tem.queJiao_RD_Open;
|
|
|
|
|
this->queJiao_width = tem.queJiao_width;
|
|
|
|
|
this->queJiao_height = tem.queJiao_height;
|
|
|
|
|
|
|
|
|
|
this->region.assign(tem.region.begin(), tem.region.end());
|
|
|
|
|
this->draw_ROI = tem.draw_ROI;
|
|
|
|
|
this->bDrawRoi = tem.bDrawRoi;
|
|
|
|
|
this->pin_x_offset = tem.pin_x_offset;
|
|
|
|
|
this->pin_y_offset = tem.pin_y_offset;
|
|
|
|
|
this->bDrawResult = tem.bDrawResult;
|
|
|
|
|
}
|
|
|
|
|
void print(std::string str)
|
|
|
|
|
{
|
|
|
|
|
printf("%s>>bOpen %d Search_threshold %d Det_threshold %d Det_Range %d QX_Widht [%d %d] QX_Height [%d %d]\n", str.c_str(),
|
|
|
|
|
bOpen, Search_threshold, Det_threshold, Det_Range, QX_Widht_min, QX_Widht_max, QX_Height_min, QX_Height_max);
|
|
|
|
|
printf("%s>>bOpen %d pin_x_offset %f pin_y_offset %f bDrawResult %d\n", str.c_str(),
|
|
|
|
|
bOpen, pin_x_offset, pin_y_offset, bDrawResult);
|
|
|
|
|
}
|
|
|
|
|
std::string GetInfo(std::string str)
|
|
|
|
|
{
|
|
|
|
|
char buffer[256];
|
|
|
|
|
sprintf(buffer, "%s>>bOpen %d Search_threshold %d Det_threshold %d Det_Range %d QX_Widht [%d %d] QX_Height [%d %d]\n", str.c_str(),
|
|
|
|
|
bOpen, Search_threshold, Det_threshold, Det_Range, QX_Widht_min, QX_Widht_max, QX_Height_min, QX_Height_max);
|
|
|
|
|
sprintf(buffer, "%s>>bOpen %d pin_x_offset %f pin_y_offset %f bDrawResult %d\n", str.c_str(),
|
|
|
|
|
bOpen, pin_x_offset, pin_y_offset, bDrawResult);
|
|
|
|
|
std::string str123 = buffer;
|
|
|
|
|
return str123;
|
|
|
|
|
}
|
|
|
|
|
@ -1298,8 +1242,8 @@ struct Base_Function_Edge_Det
|
|
|
|
|
// 基础检测功能
|
|
|
|
|
struct BaseCheckFunction
|
|
|
|
|
{
|
|
|
|
|
Base_Function_MarkLine markLine;
|
|
|
|
|
Base_Function_Edge_Det edgeDet;
|
|
|
|
|
Base_Function_ALign ALign_Config;
|
|
|
|
|
Base_Function_Pin_Det pinDet;
|
|
|
|
|
Base_Function_SaveImg saveImg;
|
|
|
|
|
Base_Function_BigNG bigNG;
|
|
|
|
|
BaseCheckFunction()
|
|
|
|
|
@ -1308,31 +1252,31 @@ struct BaseCheckFunction
|
|
|
|
|
}
|
|
|
|
|
void Init()
|
|
|
|
|
{
|
|
|
|
|
markLine.Init();
|
|
|
|
|
edgeDet.Init();
|
|
|
|
|
ALign_Config.Init();
|
|
|
|
|
pinDet.Init();
|
|
|
|
|
saveImg.Init();
|
|
|
|
|
bigNG.Init();
|
|
|
|
|
}
|
|
|
|
|
void copy(BaseCheckFunction tem)
|
|
|
|
|
{
|
|
|
|
|
this->markLine.copy(tem.markLine);
|
|
|
|
|
this->edgeDet.copy(tem.edgeDet);
|
|
|
|
|
this->ALign_Config.copy(tem.ALign_Config);
|
|
|
|
|
this->pinDet.copy(tem.pinDet);
|
|
|
|
|
this->saveImg.copy(tem.saveImg);
|
|
|
|
|
this->bigNG.copy(tem.bigNG);
|
|
|
|
|
}
|
|
|
|
|
void print(std::string str)
|
|
|
|
|
{
|
|
|
|
|
printf("******* %s *********\n", str.c_str());
|
|
|
|
|
markLine.print("markLine");
|
|
|
|
|
edgeDet.print("edgeDet");
|
|
|
|
|
ALign_Config.print("ALign_Config");
|
|
|
|
|
pinDet.print("pinDet");
|
|
|
|
|
saveImg.print("saveImg");
|
|
|
|
|
bigNG.print("bigNG");
|
|
|
|
|
}
|
|
|
|
|
std::string GetInfo(std::string str)
|
|
|
|
|
{
|
|
|
|
|
std::string str123 = "";
|
|
|
|
|
str123 += markLine.GetInfo("markLine");
|
|
|
|
|
str123 += edgeDet.GetInfo("edgeDet");
|
|
|
|
|
str123 += ALign_Config.GetInfo("ALign_Config");
|
|
|
|
|
str123 += pinDet.GetInfo("pinDet");
|
|
|
|
|
str123 += saveImg.GetInfo("saveImg");
|
|
|
|
|
str123 += bigNG.GetInfo("bigNG");
|
|
|
|
|
// str123 += "\n";
|
|
|
|
|
|