|
|
|
|
@ -919,26 +919,28 @@ struct Function_Image_Align
|
|
|
|
|
// 把手区域最大数量(参数里最多可画4个把手区域)
|
|
|
|
|
#define HANDLE_REGION_MAX_NUM 4
|
|
|
|
|
|
|
|
|
|
// 支架检测
|
|
|
|
|
struct Function_Support_Det
|
|
|
|
|
{
|
|
|
|
|
bool bOpen; // 是否开启
|
|
|
|
|
// 支架参数
|
|
|
|
|
bool bDetSupport;
|
|
|
|
|
std::vector<cv::Point> supportRegion;
|
|
|
|
|
cv::RotatedRect supportRect;
|
|
|
|
|
// 支架参数(Support_Detect)
|
|
|
|
|
bool bDetSupport; // 支架偏位检测开关(Support_Detect.isOpen)
|
|
|
|
|
float x_standard; // 水平方向标准距离(left/right 用)
|
|
|
|
|
float y_standard; // 垂直方向标准距离(up/down 用)
|
|
|
|
|
std::vector<std::string> edge_select; // 参与计算的方向:up/down/left/right
|
|
|
|
|
float x_offset;
|
|
|
|
|
float y_offset;
|
|
|
|
|
float r_offset;
|
|
|
|
|
// 把手参数(Handle_Detect)
|
|
|
|
|
bool bDetHandle; // 把手缺失检测开关(Handle_Detect.isOpen)
|
|
|
|
|
// 把手区域(最多 HANDLE_REGION_MAX_NUM 个,只保存非空的;区域宽高用于把手卡控)
|
|
|
|
|
bool bDetHandle; // 把手缺失检测开关
|
|
|
|
|
std::vector<std::vector<cv::Point>> handleRegions;
|
|
|
|
|
std::vector<cv::Rect> handleBoxes;
|
|
|
|
|
// 标签参数
|
|
|
|
|
bool bDetTag;
|
|
|
|
|
float handle_diff; // 把手差异阈值
|
|
|
|
|
// 标签参数(BQ_Detect)
|
|
|
|
|
bool bDetTag; // 标签检测开关(BQ_Detect.isOpen)
|
|
|
|
|
float BQ_area; // 标签检测参数:面积
|
|
|
|
|
float BQ_energy; // 标签检测参数:能量
|
|
|
|
|
float BQ_len; // 标签检测参数:长度
|
|
|
|
|
float BQ_hj; // 标签检测参数:灰阶
|
|
|
|
|
|
|
|
|
|
Function_Support_Det ()
|
|
|
|
|
{
|
|
|
|
|
@ -947,10 +949,7 @@ struct Function_Support_Det
|
|
|
|
|
|
|
|
|
|
void Init()
|
|
|
|
|
{
|
|
|
|
|
bOpen = false;
|
|
|
|
|
bDetSupport = false;
|
|
|
|
|
supportRegion.clear();
|
|
|
|
|
supportRect = cv::RotatedRect();
|
|
|
|
|
x_standard = 0;
|
|
|
|
|
y_standard = 0;
|
|
|
|
|
edge_select.clear();
|
|
|
|
|
@ -960,14 +959,16 @@ struct Function_Support_Det
|
|
|
|
|
bDetHandle = false;
|
|
|
|
|
handleRegions.clear();
|
|
|
|
|
handleBoxes.clear();
|
|
|
|
|
handle_diff = 20;
|
|
|
|
|
bDetTag = false;
|
|
|
|
|
BQ_area = 0;
|
|
|
|
|
BQ_energy = 0;
|
|
|
|
|
BQ_len = 0;
|
|
|
|
|
BQ_hj = 0;
|
|
|
|
|
}
|
|
|
|
|
void copy(Function_Support_Det tem)
|
|
|
|
|
{
|
|
|
|
|
this->bOpen = tem.bOpen;
|
|
|
|
|
this->bDetSupport = tem.bDetSupport;
|
|
|
|
|
this->supportRegion.assign(tem.supportRegion.begin(), tem.supportRegion.end());
|
|
|
|
|
this->supportRect = tem.supportRect;
|
|
|
|
|
this->x_standard = tem.x_standard;
|
|
|
|
|
this->y_standard = tem.y_standard;
|
|
|
|
|
this->edge_select.assign(tem.edge_select.begin(), tem.edge_select.end());
|
|
|
|
|
@ -977,18 +978,23 @@ struct Function_Support_Det
|
|
|
|
|
this->bDetHandle = tem.bDetHandle;
|
|
|
|
|
this->handleRegions.assign(tem.handleRegions.begin(), tem.handleRegions.end());
|
|
|
|
|
this->handleBoxes.assign(tem.handleBoxes.begin(), tem.handleBoxes.end());
|
|
|
|
|
this->handle_diff = tem.handle_diff;
|
|
|
|
|
this->bDetTag = tem.bDetTag;
|
|
|
|
|
this->BQ_area = tem.BQ_area;
|
|
|
|
|
this->BQ_energy = tem.BQ_energy;
|
|
|
|
|
this->BQ_len = tem.BQ_len;
|
|
|
|
|
this->BQ_hj = tem.BQ_hj;
|
|
|
|
|
}
|
|
|
|
|
void print(std::string str)
|
|
|
|
|
{
|
|
|
|
|
printf("%s>>bOpen %d bDetSupport %d bDetHandle %d bDetTag %d x_standard %f y_standard %f x_offset %f y_offset %f r_offset %f edge num %ld handleRegion num %ld\n",
|
|
|
|
|
str.c_str(), bOpen, bDetSupport, bDetHandle, bDetTag, x_standard, y_standard, x_offset, y_offset, r_offset, edge_select.size(), handleRegions.size());
|
|
|
|
|
printf("%s>>bDetSupport %d bDetHandle %d bDetTag %d x_standard %f y_standard %f x_offset %f y_offset %f r_offset %f edge num %ld handleRegion num %ld handle_diff %f BQ[area %f energy %f len %f hj %f]\n",
|
|
|
|
|
str.c_str(), bDetSupport, bDetHandle, bDetTag, x_standard, y_standard, x_offset, y_offset, r_offset, edge_select.size(), handleRegions.size(), handle_diff, BQ_area, BQ_energy, BQ_len, BQ_hj);
|
|
|
|
|
}
|
|
|
|
|
std::string GetInfo(std::string str)
|
|
|
|
|
{
|
|
|
|
|
char buffer[256];
|
|
|
|
|
sprintf(buffer, "%s>>bOpen %d bDetSupport %d bDetHandle %d bDetTag %d x_standard %f y_standard %f x_offset %f y_offset %f r_offset %f edge num %ld handleRegion num %ld\n",
|
|
|
|
|
str.c_str(), bOpen, bDetSupport, bDetHandle, bDetTag, x_standard, y_standard, x_offset, y_offset, r_offset, edge_select.size(), handleRegions.size());
|
|
|
|
|
char buffer[512];
|
|
|
|
|
sprintf(buffer, "%s>>bDetSupport %d bDetHandle %d bDetTag %d x_standard %f y_standard %f x_offset %f y_offset %f r_offset %f edge num %ld handleRegion num %ld handle_diff %f BQ[area %f energy %f len %f hj %f]\n",
|
|
|
|
|
str.c_str(), bDetSupport, bDetHandle, bDetTag, x_standard, y_standard, x_offset, y_offset, r_offset, edge_select.size(), handleRegions.size(), handle_diff, BQ_area, BQ_energy, BQ_len, BQ_hj);
|
|
|
|
|
std::string str123 = buffer;
|
|
|
|
|
return str123;
|
|
|
|
|
}
|
|
|
|
|
@ -1004,7 +1010,6 @@ struct CheckFunction
|
|
|
|
|
Function_ShieldRegion f_ShieldRegion;
|
|
|
|
|
Function_EdgeROI f_EdgeROI;
|
|
|
|
|
Function_Image_Align f_Image_Align; // 图片特征对齐
|
|
|
|
|
Function_Support_Det f_supportDet;
|
|
|
|
|
CheckFunction()
|
|
|
|
|
{
|
|
|
|
|
Init();
|
|
|
|
|
@ -1017,7 +1022,6 @@ struct CheckFunction
|
|
|
|
|
f_ShieldRegion.Init();
|
|
|
|
|
f_EdgeROI.Init();
|
|
|
|
|
f_Image_Align.Init();
|
|
|
|
|
f_supportDet.Init();
|
|
|
|
|
}
|
|
|
|
|
void copy(CheckFunction tem)
|
|
|
|
|
{
|
|
|
|
|
@ -1028,7 +1032,6 @@ struct CheckFunction
|
|
|
|
|
this->f_ShieldRegion.copy(tem.f_ShieldRegion);
|
|
|
|
|
this->f_EdgeROI.copy(tem.f_EdgeROI);
|
|
|
|
|
this->f_Image_Align.copy(tem.f_Image_Align);
|
|
|
|
|
this->f_supportDet.copy(tem.f_supportDet);
|
|
|
|
|
}
|
|
|
|
|
void print(std::string str)
|
|
|
|
|
{
|
|
|
|
|
@ -1039,7 +1042,6 @@ struct CheckFunction
|
|
|
|
|
f_ShieldRegion.print("ShieldRegion");
|
|
|
|
|
f_EdgeROI.print("EdgeROI");
|
|
|
|
|
f_Image_Align.print("Image_Align");
|
|
|
|
|
f_supportDet.print("supportDet");
|
|
|
|
|
}
|
|
|
|
|
std::string GetInfo(std::string str)
|
|
|
|
|
{
|
|
|
|
|
@ -1051,7 +1053,6 @@ struct CheckFunction
|
|
|
|
|
str123 += f_ShieldRegion.GetInfo("ShieldRegion");
|
|
|
|
|
str123 += f_EdgeROI.GetInfo("EdgeROI");
|
|
|
|
|
str123 += f_Image_Align.GetInfo("Image_Align");
|
|
|
|
|
str123 += f_supportDet.GetInfo("supportDet");
|
|
|
|
|
return str123;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
@ -1377,6 +1378,7 @@ struct BaseCheckFunction
|
|
|
|
|
Base_Function_Edge_Det edgeDet;
|
|
|
|
|
Base_Function_SaveImg saveImg;
|
|
|
|
|
Base_Function_BigNG bigNG;
|
|
|
|
|
Function_Support_Det supportDet; // 支架/把手/标签检测(Support_Detect/Handle_Detect/BQ_Detect)
|
|
|
|
|
|
|
|
|
|
BaseCheckFunction()
|
|
|
|
|
{
|
|
|
|
|
@ -1388,6 +1390,7 @@ struct BaseCheckFunction
|
|
|
|
|
edgeDet.Init();
|
|
|
|
|
saveImg.Init();
|
|
|
|
|
bigNG.Init();
|
|
|
|
|
supportDet.Init();
|
|
|
|
|
}
|
|
|
|
|
void copy(BaseCheckFunction tem)
|
|
|
|
|
{
|
|
|
|
|
@ -1395,6 +1398,7 @@ struct BaseCheckFunction
|
|
|
|
|
this->edgeDet.copy(tem.edgeDet);
|
|
|
|
|
this->saveImg.copy(tem.saveImg);
|
|
|
|
|
this->bigNG.copy(tem.bigNG);
|
|
|
|
|
this->supportDet.copy(tem.supportDet);
|
|
|
|
|
}
|
|
|
|
|
void print(std::string str)
|
|
|
|
|
{
|
|
|
|
|
@ -1403,6 +1407,7 @@ struct BaseCheckFunction
|
|
|
|
|
edgeDet.print("edgeDet");
|
|
|
|
|
saveImg.print("saveImg");
|
|
|
|
|
bigNG.print("bigNG");
|
|
|
|
|
supportDet.print("supportDet");
|
|
|
|
|
}
|
|
|
|
|
std::string GetInfo(std::string str)
|
|
|
|
|
{
|
|
|
|
|
@ -1411,6 +1416,7 @@ struct BaseCheckFunction
|
|
|
|
|
str123 += edgeDet.GetInfo("edgeDet");
|
|
|
|
|
str123 += saveImg.GetInfo("saveImg");
|
|
|
|
|
str123 += bigNG.GetInfo("bigNG");
|
|
|
|
|
str123 += supportDet.GetInfo("supportDet");
|
|
|
|
|
// str123 += "\n";
|
|
|
|
|
return str123;
|
|
|
|
|
}
|
|
|
|
|
|