You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2444 lines
60 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*
* @Descripttion:
* @version:
* @Author: sueRimn
* @Date: 2022-03-16 17:09:11
* @LastEditors: xiewenji 527774126@qq.com
* @LastEditTime: 2025-09-30 14:21:07
*/
/***********************************************/
/************ ***************/
/************金佰利检测算法参数定义**************/
/************ **************/
/**********************************************/
#ifndef _CheckConfigDefine_HPP_
#define _CheckConfigDefine_HPP_
#include <string>
#include "ConfigBase.h"
#include <opencv2/opencv.hpp>
#define MASK_IMG_STEP 16
#define MASK_IMG_STARTVALUE 48
// 一个检测缺陷 最多有几组参数
#define MASK_QX_PARAM_NUM 3
enum REGIONTYPE_
{
REGION_TYPE_CHECK, // 检测区域
REGION_TYPE_SHIELD, // 屏蔽区域
};
enum CONFIG_QX_WHITE_BLCAK
{
CONFIG_QX_BLACK, // 分类 AD异显(P6873)
CONFIG_QX_WHITE, // 分类 AD异显(P6873)
};
static const std::string WHITE_BLCAK_Names[] =
{
"black",
"white"};
// 检测缺陷的种类
// 检测缺陷的种类
enum CONFIG_QX_NAME_
{
CONFIG_QX_NAME_ok_yisi, // 疑似
CONFIG_QX_NAME_AD_YX, // AD异显(P6873)
CONFIG_QX_NAME_Class_AD_YX, // 分类 AD异显(P6873)
CONFIG_QX_NAME_X_line, // X_line(P3351)
CONFIG_QX_NAME_Y_line, // Y_line(P3452)
CONFIG_QX_NAME_Fangge, // Y_Fangge_line(P3453) 方格
CONFIG_QX_NAME_Broken_line, // 断线(P3379)
CONFIG_QX_NAME_zara, // ZARA(P1153)
CONFIG_QX_NAME_MTX, // MTX(P1164)
CONFIG_QX_NAME_POL_Cell, // 异物(P1101)
CONFIG_QX_NAME_LD, // 亮点(P1112)
CONFIG_QX_NAME_AD, // 暗点(P1111)
CONFIG_QX_NAME_Scratch_L1, // 一级 轻 划伤(P1557)
CONFIG_QX_NAME_Scratch_L2, // 二级 严重 划伤(P1557)
CONFIG_QX_NAME_Dirty_L0, // 疑似浅层脏污(P0000)
CONFIG_QX_NAME_Dirty_L1, // 轻脏污(P0000)
CONFIG_QX_NAME_Dirty_L2, // 严重脏污(P0000)
CONFIG_QX_NAME_qipao, // 气泡(P0001)
CONFIG_QX_NAME_PS, // ps(P0002)
CONFIG_QX_NAME_Weak_Bright_Mura, // 白GAP(P1654)
CONFIG_QX_NAME_No_Label, // 缺POL(P2833)
CONFIG_QX_NAME_Other, // 缺POL(P2833)
CONFIG_QX_NAME_line, // 缺POL(P3351)
CONFIG_QX_NAME_LD_WTB, // 亮点 WTB(P1112)
CONFIG_QX_NAME_Chess, // Chess 异常
CONFIG_QX_NAME_127Cell, // 白cell
CONFIG_QX_NAME_white_Cell, // 白cell
CONFIG_QX_NAME_black_Cell, // 白cell
CONFIG_QX_NAME_LD_HS, // 黑闪类画面的亮点
CONFIG_QX_NAME_LackPOL, // 缺失pol检测
CONFIG_QX_NAME_count,
};
// 缺陷项对应在参数中的名称
static std::vector<std::string> CONFIG_QX_NAME_Names =
{
"ok_yisi",
"AD_YX",
"Class_AD_YX",
"X_line",
"Y_line",
"fangge",
"Broken_line",
"zara",
"MTX",
"Pol_Cell",
"LD",
"AD",
"Scratch_L1",
"Scratch_L2",
"Dirty_L0",
"Dirty_L1",
"Dirty_L2",
"qipao",
"PS",
"Weak_Bright_Mura",
"No_Label",
"qx_Other",
"line",
"LD_WTB",
"qx_Chess",
"Cell127",
"white_Cell",
"black_Cell",
"LD_HS",
"LackPOL"};
// web控制检测的缺陷类型
enum Function_CONFIG_QX_NAME_
{
Function_CONFIG_QX_NAME_ok_yisi, // 疑似
Function_CONFIG_QX_NAME_YX, // AD异显(P6873)
Function_CONFIG_QX_NAME_line, // X_line(P3351)
Function_CONFIG_QX_NAME_zara, // ZARA(P1153)
Function_CONFIG_QX_NAME_MTX, // MTX(P1164)
Function_CONFIG_QX_NAME_POL_Cell, // 异物(P1101)
Function_CONFIG_QX_NAME_LD, // 亮点(P1112)
Function_CONFIG_QX_NAME_AD, // 暗点(P1111)
Function_CONFIG_QX_NAME_Scratch, // 划伤(P1557)
Function_CONFIG_QX_NAME_Dirty, // 脏污(P0000)
Function_CONFIG_QX_NAME_qipao, // 气泡(P0001)
Function_CONFIG_QX_NAME_PS, // ps(P0002)
Function_CONFIG_QX_NAME_Weak_Bright_Mura, // 白GAP(P1654)
Function_CONFIG_QX_NAME_No_Label, // 缺POL(P2833)
Function_CONFIG_QX_NAME_Other, // 缺POL(P2833)
Function_CONFIG_QX_NAME_Chess, // Chess 异常
Function_CONFIG_QX_NAME_127Cell, // 白cell
Function_CONFIG_QX_NAME_Cell, // 独立检测的黑白cell点
Function_CONFIG_QX_NAME_count,
};
// 缺陷项对应在参数中的名称
static const std::string Function_CONFIG_QX_NAME_Names[] =
{
"OK_Yisi",
"AD_YX",
"Line",
"ZARA",
"MXT",
"POL_Cell",
"LD",
"AnDot",
"Scratch",
"Dirty",
"Qipao",
"PS",
"Weak_Bright_Mura",
"No_Label",
"Other",
"Chess",
"Cell127",
"Cell"};
// 通道名称定义
enum IMG_CHANNEL_
{
IMG_CHANNEL_UP,
IMG_CHANNEL_DP,
IMG_CHANNEL_L63,
IMG_CHANNEL_L127,
IMG_CHANNEL_L255,
IMG_CHANNEL_RED,
IMG_CHANNEL_GREEN,
IMG_CHANNEL_BLUE,
IMG_CHANNEL_HS,
IMG_CHANNEL_HB3,
IMG_CHANNEL_HB4,
IMG_CHANNEL_CHESS1,
IMG_CHANNEL_CHESS2,
IMG_CHANNEL_CHESS,
IMG_CHANNEL_AGO,
IMG_CHANNEL_BTW,
IMG_CHANNEL_WTB,
IMG_CHANNEL_TBW,
IMG_CHANNEL_L0,
IMG_CHANNEL_RGBHGRAY,
IMG_CHANNEL_SCANR,
IMG_CHANNEL_SCANG,
IMG_CHANNEL_SCANB,
IMG_CHANNEL_Count,
};
// 缺陷项对应在参数中的名称
static const std::string IMG_CHANNEL_NAME[] =
{
"Up-Particle",
"Down-Particle",
"L63",
"L127",
"L255",
"Red",
"Green",
"Blue",
"HS",
"HB3",
"HB4",
"CHESS1",
"CHESS2",
"CHESS",
"AGO",
"BTW",
"WTB",
"TBW",
"L0",
"RGB-HGRAY",
"SCANR",
"SCANG",
"SCANB"
};
// 分析类型
enum ANALYSIS_TYPE_
{
ANALYSIS_TYPE_TF, // 踢废 打标分析
ANALYSIS_TYPE_YS, // 疑是 分析
ANALYSIS_TYPE_COUNT,
};
static const std::string ANALYSIS_TYPE_Names[] =
{
"Check_Param",
"SaveImg_Param"};
// 分析类型
enum QX_RESULT_TYPE_
{
QX_RESULT_TYPE_OK, // 踢废 打标分析
QX_RESULT_TYPE_NG, // 疑是 分析
QX_RESULT_TYPE_YS,
QX_RESULT_TYPE_NoJduge, // 未判断
QX_RESULT_TYPE_COUNT
};
static const std::string QX_RESULT_TYPE_Names[] =
{
"OK",
"NG",
"YS",
"NoJudge"};
// AI模型路径参数
struct ModelConfigST
{
std::string defect_model_path = "";
std::string defect_wtb_model_path = "";
std::string defect_chess_model_path = "";
std::string YX_1_model_path = "";
std::string YX_2_model_path = "";
std::string zf_model_path = "";
std::string class_model_path = ""; // 1024dyy-add
std::string class_L0_model_path = ""; // 1024dyy-add
std::string class_L255_model_path = ""; // 1024dyy-add
std::string UP_model_path = ""; // 1024dyy-add
void copy(ModelConfigST tem)
{
this->defect_model_path = tem.defect_model_path;
this->YX_1_model_path = tem.YX_1_model_path;
this->YX_2_model_path = tem.YX_2_model_path;
this->defect_wtb_model_path = tem.defect_wtb_model_path;
this->defect_chess_model_path = tem.defect_chess_model_path;
this->zf_model_path = tem.zf_model_path;
this->class_model_path = tem.class_model_path; // 1024dyy-add
this->class_L0_model_path = tem.class_L0_model_path; // 1024dyy-add
this->class_L255_model_path = tem.class_L255_model_path; // 1024dyy-add
this->UP_model_path = tem.UP_model_path; // 1024dyy-add
}
bool valid()
{
if (defect_model_path != "" &&
YX_1_model_path != "" &&
class_model_path != "")
{
return true;
}
return false;
}
};
struct CAM_CONFIGINFO_
{
float fscale_x;
float fscale_y; // 相机分辨率
CAM_CONFIGINFO_()
{
fscale_x = 0.15f;
fscale_y = 0.15f;
}
void copy(CAM_CONFIGINFO_ tem)
{
this->fscale_x = tem.fscale_x;
this->fscale_y = tem.fscale_y;
}
};
struct RegionBasicInfo
{
std::string name; // 区域名称
int type; // 区域类型
int lay; // 层级
std::vector<cv::Point> pointArry; // 区域点
std::vector<std::string> ChannelArry; // 通道区域
bool bdraw; // 是否绘制
RegionBasicInfo()
{
Init();
}
void Init()
{
name = "";
type = 0;
lay = 0;
bdraw = false;
pointArry.clear();
pointArry.shrink_to_fit();
ChannelArry.clear();
ChannelArry.shrink_to_fit();
}
void copy(RegionBasicInfo tem)
{
this->name = tem.name;
this->type = tem.type;
this->lay = tem.lay;
this->bdraw = tem.bdraw;
this->pointArry.assign(tem.pointArry.begin(), tem.pointArry.end());
this->ChannelArry.assign(tem.ChannelArry.begin(), tem.ChannelArry.end());
}
};
struct AandEParam
{
bool bEnable; // 是否启用
bool bOk; // 好品条件
float area; // 面积
float area_max; // 面积上限
float energy; // 能量
float hj; // 灰阶
float length; // 长度
int num; // 数量
float dis; // 距离
float density; // 密度
AandEParam()
{
bOk = false;
bEnable = false;
area = -1;
area_max = -1;
energy = -1;
hj = -1;
length = -1;
num = -1;
dis = -1;
density = -1;
}
void print(std::string str)
{
printf("%s bEnable %d bOk %d area %f area_max %f energy %f hj %f length %f num %d dis %f density %f \n", str.c_str(), bEnable, bOk, area, area_max, energy, hj, length, num, dis, density);
}
void copy(AandEParam tem)
{
this->bEnable = tem.bEnable;
this->bOk = tem.bOk;
this->area = tem.area;
this->area_max = tem.area_max;
this->energy = tem.energy;
this->hj = tem.hj;
this->length = tem.length;
this->num = tem.num;
this->dis = tem.dis;
this->density = tem.density;
}
};
// 区域的检测参数
struct CheckConfig_Regions_Param
{
std::vector<AandEParam> paramArr;
std::string param_name;
int useNum; // 使用个数
CheckConfig_Regions_Param()
{
paramArr.clear();
paramArr.shrink_to_fit();
useNum = 0;
param_name = "";
}
void addParam(AandEParam param)
{
paramArr.push_back(param);
useNum++;
}
};
// 不同缺陷类型参数
struct CheckConfig_Regions_type
{
std::vector<CheckConfig_Regions_Param> checkConfig_Regions_Param;
};
// 区域相关参数
struct RegionConfigST
{
bool buse; // 是否使用
RegionBasicInfo basicInfo; // 基础信息
CheckConfig_Regions_type checkConfig_Regions_type[ANALYSIS_TYPE_COUNT];
RegionConfigST()
{
buse = false;
} /* data */
};
bool compareBylay(const RegionConfigST &a, const RegionConfigST &b);
// 检测参数层级关系
// 1、区域
// 2、 检测项目
// 3、 参数 阈值
// 阈值参数系数
struct THRESHOLD_RATIO
{
float farea;
float fenergy;
bool bEnable;
THRESHOLD_RATIO()
{
farea = 1;
fenergy = 1;
bEnable = false;
;
}
void copy(THRESHOLD_RATIO tem)
{
this->farea = tem.farea;
this->fenergy = tem.fenergy;
this->bEnable = tem.bEnable;
}
void printfInfo(std::string str)
{
printf("%s bEnable %d farea %f fenergy %f \n", str.c_str(), bEnable, farea, fenergy);
}
};
// 区域无关的基本参数
struct BasicConfig
{
std::string strCamearName;
int image_widht;
int Image_height;
int width_min; // 20231122xls-add
int width_max;
int height_min;
int height_max; // 20231122xls-add
bool bDrawShieldRoi; // 绘制屏蔽区域
bool bShield_ZF; // 屏蔽字符区域,不检测
bool bDrawPreRoi; // 绘制弱化区域
float fUP_IOU;
bool bCal_ImageScale; // 是否自动计算成像精度
float Product_Size_Width_mm; // 产品尺寸 宽度 mm
float Product_Size_Height_mm; // 产品尺寸 高度 mm
float fImage_Scale_x; // 成像精度
float fImage_Scale_y; // 成像精度
float fProduct_Off_X_mm; // 产品偏移量
std::string strCamName; //
float density_R_mm; // 密度计算半径 像素
BasicConfig()
{
Image_height = 0;
image_widht = 0;
width_min = 0; // 20231122xls-add
width_max = 999999;
height_min = 0;
height_max = 999999;
bDrawShieldRoi = false;
bShield_ZF = false;
bDrawPreRoi = false;
fUP_IOU = 0.9;
bCal_ImageScale = false;
Product_Size_Width_mm = 100;
Product_Size_Height_mm = 1000;
fImage_Scale_x = 0.03;
fImage_Scale_y = 0.03;
density_R_mm = 5;
strCamName = "";
fProduct_Off_X_mm = 0;
strCamearName = EMPTY_CONFIG_NAME;
}
void copy(BasicConfig tem)
{
this->image_widht = tem.image_widht;
this->Image_height = tem.Image_height;
this->width_min = tem.width_min; // 20231122xls-add
this->width_max = tem.width_max;
this->height_min = tem.height_min;
this->height_max = tem.height_max;
this->bDrawShieldRoi = tem.bDrawShieldRoi;
this->bShield_ZF = tem.bShield_ZF;
this->fUP_IOU = tem.fUP_IOU;
this->bDrawPreRoi = tem.bDrawPreRoi;
this->strCamName = tem.strCamName;
this->fProduct_Off_X_mm = tem.fProduct_Off_X_mm;
this->bCal_ImageScale = tem.bCal_ImageScale;
this->Product_Size_Width_mm = tem.Product_Size_Width_mm;
this->Product_Size_Height_mm = tem.Product_Size_Height_mm;
this->fImage_Scale_x = tem.fImage_Scale_x;
this->fImage_Scale_y = tem.fImage_Scale_y;
this->density_R_mm = tem.density_R_mm;
this->strCamearName = tem.strCamearName;
}
void print(std::string 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("fImage_Scale_x =%f fImage_Scale_y=%f \n", fImage_Scale_x, fImage_Scale_y);
// 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 fProduct_Off_X %f\n",
bDrawShieldRoi, bShield_ZF, bDrawPreRoi, fUP_IOU, density_R_mm, fProduct_Off_X_mm);
printf("============================↑↑↑↑↑↑%s↑↑↑↑↑↑=========================\n", str.c_str());
}
};
struct NodeBasicConfig
{
float calss_conf; // 分类阈值参数,低于这个阈值的不处理,
float calss_area; // 分类阈值参数,低于这个阈值的不处理,
int img_width;
int img_height;
NodeBasicConfig()
{
calss_conf = 0.5;
calss_area = 1.0;
}
void copy(NodeBasicConfig tem)
{
this->calss_conf = tem.calss_conf;
this->calss_area = tem.calss_area;
}
void print(std::string str = "")
{
printf("============================↓↓↓↓↓↓%s↓↓↓↓↓↓↓=========================\n", str.c_str());
printf("img_width %d img_height %d alss_conf %f calss_area %f \n", img_width, img_height, calss_conf, calss_area);
printf("============================↑↑↑↑↑↑%s↑↑↑↑↑↑=========================\n", str.c_str());
}
};
// 多节点
struct CommonConfigNodeST
{
NodeBasicConfig nodebasicConfog;
std::vector<RegionConfigST> regionConfigArr;
cv::Mat mask;
// cv::Mat SheildMask[IMG_CHANNEL_Count];
void copy(CommonConfigNodeST tem)
{
this->regionConfigArr.assign(tem.regionConfigArr.begin(), tem.regionConfigArr.end());
this->nodebasicConfog.copy(tem.nodebasicConfog);
if (!tem.mask.empty())
{
this->mask = tem.mask.clone();
}
// for (int i = 0; i < IMG_CHANNEL_Count; i++)
// {
// if (!tem.SheildMask[i].empty())
// {
// this->SheildMask[i] = tem.SheildMask[i].clone();
// }
// }
}
void InitSheildMask() {
// for (int i = 0; i < IMG_CHANNEL_Count; i++)
// {
// if (!SheildMask[i].empty())
// {
// SheildMask[i].release();
// }
// }
};
void ToSheildMaskImg()
{
// printf("ToSheildMaskImg img_height %d, img_width %d\n", nodebasicConfog.img_height, nodebasicConfog.img_width);
// if (nodebasicConfog.img_width <= 0 || nodebasicConfog.img_height <= 0)
// {
// return; /* code */
// }
// InitSheildMask();
// printf("regionConfigArr.size() %d \n", regionConfigArr.size());
// std::sort(regionConfigArr.begin(), regionConfigArr.end(), compareBylay);
// for (int i = 0; i < regionConfigArr.size(); i++)
// {
// printf("mask %d / %d type =%d \n", i, regionConfigArr.size(), regionConfigArr.at(i).basicInfo.type);
// if (regionConfigArr.at(i).basicInfo.type == 1)
// {
// for (int ic = 0; ic < regionConfigArr.at(i).basicInfo.ChannelArry.size(); ic++)
// {
// std::string strChannel = regionConfigArr.at(i).basicInfo.ChannelArry.at(ic);
// int idx = -1;
// for (int pc = 0; pc < IMG_CHANNEL_Count; pc++)
// {
// if (IMG_CHANNEL_NAME[pc] == strChannel)
// {
// idx = pc;
// }
// }
// printf("%d -- %s idx %d\n", ic, strChannel.c_str(), idx);
// if (idx >= 0)
// {
// if (SheildMask[idx].empty())
// {
// SheildMask[idx] = cv::Mat(nodebasicConfog.img_height, nodebasicConfog.img_width, CV_8U, cv::Scalar(0));
// }
// cv::fillPoly(SheildMask[idx], regionConfigArr.at(i).basicInfo.pointArry, cv::Scalar(255));
// // cv::imwrite(std::to_string(idx)+"_"+strChannel+".png",SheildMask[idx]);
// }
// }
// }
// }
}
void ToMaskImg()
{
printf("nodebasicConfog.img_height %d, nodebasicConfog.img_width %d\n", nodebasicConfog.img_height, nodebasicConfog.img_width);
if (nodebasicConfog.img_width <= 0 || nodebasicConfog.img_height <= 0)
{
return; /* code */
}
mask = cv::Mat(nodebasicConfog.img_height, nodebasicConfog.img_width, CV_8U, cv::Scalar(0));
std::sort(regionConfigArr.begin(), regionConfigArr.end(), compareBylay);
for (int i = 0; i < regionConfigArr.size(); i++)
{
// 只绘制检测区域
if (regionConfigArr.at(i).basicInfo.type != 0)
{
continue;
}
// printf("*-*-*-*- %d \n", regionConfigArr.at(i).basicInfo.lay);
int nv = MASK_IMG_STEP * i + MASK_IMG_STARTVALUE;
if (nv < 0 || nv > 255)
{
nv = 255;
}
cv::fillPoly(mask, regionConfigArr.at(i).basicInfo.pointArry, cv::Scalar(nv));
// {
// std::vector<cv::Point> src_pointArry; // 区域点
// float src_scale_x = SRCIMG_WIDTH * 1.0f / CHECKIMG_WIDTH;
// float src_scale_y = SRCIMG_HEIGHT * 1.0f / CHECKIMG_HEIGHT;
// for (int j = 0; j < regionConfigArr.at(i).basicInfo.pointArry.size(); j++)
// {
// cv::Point temp;
// temp.x = src_scale_x * regionConfigArr.at(i).basicInfo.pointArry.at(j).x;
// temp.y = src_scale_y * regionConfigArr.at(i).basicInfo.pointArry.at(j).y;
// src_pointArry.push_back(temp);
// // printf("--- %d %d **--- %d %d\n",temp.x,temp.y, regionConfigArr.at(i).basicInfo.pointArry.at(j).x, regionConfigArr.at(i).basicInfo.pointArry.at(j).y);
// }
// cv::fillConvexPoly(Src_mask, src_pointArry, cv::Scalar(nv));
// }
}
}
};
// 和图片相关的参数
struct CommonCheckConfigST
{
BasicConfig baseConfig;
// 节点参数数据集
std::vector<CommonConfigNodeST> nodeConfigArr;
CommonCheckConfigST()
{
nodeConfigArr.clear();
nodeConfigArr.shrink_to_fit();
}
void copy(CommonCheckConfigST tem)
{
this->nodeConfigArr.assign(tem.nodeConfigArr.begin(), tem.nodeConfigArr.end());
this->baseConfig.copy(tem.baseConfig);
}
};
// 基础检测
struct Function_Base_Det
{
bool bOpen; // 是否开启
std::string strAIMode; // 模型名称
std::vector<std::string> DetQXList; // 检测缺陷list
Function_Base_Det()
{
Init();
}
void Init()
{
bOpen = false;
strAIMode = "";
DetQXList.clear();
DetQXList.shrink_to_fit();
}
void copy(Function_Base_Det tem)
{
this->bOpen = tem.bOpen;
this->strAIMode = tem.strAIMode;
this->DetQXList.assign(tem.DetQXList.begin(), tem.DetQXList.end());
}
void print(std::string str)
{
printf("%s>>bOpen %d strAIMode %s ", str.c_str(), bOpen, strAIMode.c_str());
for (int i = 0; i < DetQXList.size(); i++)
{
printf("%s ", DetQXList.at(i).c_str());
}
printf(" \n");
}
std::string GetInfo(std::string str)
{
char buffer[128];
sprintf(buffer, "%s>>bOpen:%d AIMode:%s ", str.c_str(), bOpen, strAIMode.c_str());
std::string str123 = buffer;
for (int i = 0; i < DetQXList.size(); i++)
{
str123 += DetQXList.at(i) + ";";
}
str123 += "\n";
return str123;
}
};
// 检测功能使用UP画面的缺陷进行过滤
struct Function_Use_UP_QX
{
bool bOpen; // 是否开启
float fIOU; // IOU 值
Function_Use_UP_QX()
{
Init();
}
void Init()
{
bOpen = false;
fIOU = 0.80;
}
void copy(Function_Use_UP_QX tem)
{
this->bOpen = tem.bOpen;
this->fIOU = tem.fIOU;
}
void print(std::string str)
{
printf("%s>>bOpen %d, IOU %f \n", str.c_str(), bOpen, fIOU);
}
std::string GetInfo(std::string str)
{
char buffer[64];
sprintf(buffer, "%s>>bOpen:%d fIOU:%f \n", str.c_str(), bOpen, fIOU);
std::string str123 = buffer;
return str123;
}
};
// 只生成Blob不进行分析
struct Function_OnlyBLob
{
bool bOpen; // 是否开启
Function_OnlyBLob()
{
Init();
}
void Init()
{
bOpen = false;
}
void copy(Function_OnlyBLob tem)
{
this->bOpen = tem.bOpen;
}
void print(std::string str)
{
printf("%s>>bOpen %d\n", str.c_str(), bOpen);
}
std::string GetInfo(std::string str)
{
char buffer[64];
sprintf(buffer, "%s>>bOpen %d\n", str.c_str(), bOpen);
std::string str123 = buffer;
return str123;
}
};
// 异显检测
struct Function_YXDet
{
bool bOpen; // 是否开启
std::string strModle;
Function_YXDet()
{
Init();
}
void Init()
{
bOpen = false;
strModle = "";
}
void copy(Function_YXDet tem)
{
this->bOpen = tem.bOpen;
this->strModle = tem.strModle;
}
void print(std::string str)
{
printf("%s>>bOpen %d strModle %s\n", str.c_str(), bOpen, strModle.c_str());
}
std::string GetInfo(std::string str)
{
char buffer[64];
sprintf(buffer, "%s>>bOpen %d strModle %s\n", str.c_str(), bOpen, strModle.c_str());
std::string str123 = buffer;
return str123;
}
};
struct Function_AI_QX
{
bool bOpen; // 是否开启
bool bPOLToWhitePOL; // 异物转白异物
bool bAllToChess; // 所有缺陷转Chess
bool b127WhitePOl_UseDP; // 127 画面的白cell是否依赖dp异物结果。
float f127WhitePOl_DP_IOU;
Function_AI_QX()
{
Init();
}
void Init()
{
bOpen = false;
bPOLToWhitePOL = false;
bAllToChess = false;
b127WhitePOl_UseDP = false;
f127WhitePOl_DP_IOU = 0.5;
}
void copy(Function_AI_QX tem)
{
this->bOpen = tem.bOpen;
this->bPOLToWhitePOL = tem.bPOLToWhitePOL;
this->bAllToChess = tem.bAllToChess;
this->b127WhitePOl_UseDP = tem.b127WhitePOl_UseDP;
this->f127WhitePOl_DP_IOU = tem.f127WhitePOl_DP_IOU;
}
void print(std::string str)
{
printf("%s>>bOpen %d POLToWhitePOL %d AllToChess %d 127WhitePOl_UseDP %d 127WhitePOl_DP_IOU %f\n",
str.c_str(), bOpen, bPOLToWhitePOL, bAllToChess, b127WhitePOl_UseDP, f127WhitePOl_DP_IOU);
}
std::string GetInfo(std::string str)
{
char buffer[128];
sprintf(buffer, "%s>>bOpen %d POLToWhitePOL %d AllToChess %d 127WhitePOl_UseDP %d 127WhitePOl_DP_IOU %f\n",
str.c_str(), bOpen, bPOLToWhitePOL, bAllToChess, b127WhitePOl_UseDP, f127WhitePOl_DP_IOU);
std::string str123 = buffer;
return str123;
}
};
// 亮点
struct Function_AI_LD
{
bool bOpen; // 是否开启
bool bUseDP; // 是否使用DP检测结果
bool bWTBLD; // 是否是WTB亮点
bool bHSLD; // 黑闪类型的亮点
float fDP_IOU; // DP的IOU
Function_AI_LD()
{
Init();
}
void Init()
{
bOpen = false;
bUseDP = false;
bWTBLD = false;
bHSLD = false;
fDP_IOU = 0.1;
}
void copy(Function_AI_LD tem)
{
this->bOpen = tem.bOpen;
this->bUseDP = tem.bUseDP;
this->bWTBLD = tem.bWTBLD;
this->bHSLD = tem.bHSLD;
this->fDP_IOU = tem.fDP_IOU;
}
void print(std::string str)
{
printf("%s>>bOpen %d bUseDP %d bWTBLD %d bHSLD %d fDP_IOU %f\n", str.c_str(), bOpen, bUseDP, bWTBLD, bHSLD, fDP_IOU);
}
std::string GetInfo(std::string str)
{
char buffer[64];
sprintf(buffer, "%s>>bOpen %d bUseDP %d bWTBLD %d bHSLD %d fDP_IOU %f\n", str.c_str(), bOpen, bUseDP, bWTBLD, bHSLD, fDP_IOU);
std::string str123 = buffer;
return str123;
}
};
// 大缺陷检测参数
struct Function_BigQX
{
bool bOpen; // 是否开启
float Single_Area; // 单个缺陷的面积
int Single_HJ; // 单个缺陷的灰机
float Single_Len; // 单个缺陷的长度
int Sum_blob_Num; // 总面积统计 blob数量
float Sum_Area; // 总面积统计 面积参数
Function_BigQX()
{
Init();
}
void Init()
{
bOpen = false;
Single_Area = 80;
Single_HJ = 60;
Single_Len = 5;
Sum_blob_Num = 5;
Sum_Area = 100;
}
void copy(Function_BigQX tem)
{
this->bOpen = tem.bOpen;
this->Single_Area = tem.Single_Area;
this->Single_HJ = tem.Single_HJ;
this->Single_Len = tem.Single_Len;
this->Sum_blob_Num = tem.Sum_blob_Num;
this->Sum_Area = tem.Sum_Area;
}
void print(std::string str)
{
printf("%s>>bOpen %d single area %f hj %d len %f sum blob num %d area %f\n", str.c_str(),
bOpen, Single_Area, Single_HJ, Single_Len, Sum_blob_Num, Sum_Area);
}
std::string GetInfo(std::string str)
{
char buffer[128];
sprintf(buffer, "%s>>bOpen %d single area %f hj %d len %f sum blob num %d area %f\n", str.c_str(),
bOpen, Single_Area, Single_HJ, Single_Len, Sum_blob_Num, Sum_Area);
std::string str123 = buffer;
return str123;
}
};
// 屏蔽区域参数
struct Function_ShieldRegion
{
bool bOpen; // 是否开启
bool bHave; // 是否有屏蔽区域
bool bDraw; // 是否绘制
cv::Mat shieldMask; // 屏蔽区域图片
std::vector<cv::Point> pointArry1; // 区域点
std::vector<cv::Point> pointArry2; // 区域点
std::vector<cv::Point> pointArry3; // 区域点
std::vector<cv::Point> pointArry4; // 区域点
std::vector<cv::Point> pointArry5; // 区域点
Function_ShieldRegion()
{
Init();
}
void Init()
{
bOpen = false;
bDraw = true;
bHave = false;
pointArry1.clear();
pointArry1.shrink_to_fit();
pointArry2.clear();
pointArry2.shrink_to_fit();
pointArry3.clear();
pointArry3.shrink_to_fit();
pointArry4.clear();
pointArry4.shrink_to_fit();
pointArry5.clear();
pointArry5.shrink_to_fit();
if (!shieldMask.empty())
{
shieldMask.release();
}
}
void copy(Function_ShieldRegion tem)
{
this->bOpen = tem.bOpen;
this->bDraw = tem.bDraw;
this->bHave = tem.bHave;
this->shieldMask = tem.shieldMask.clone();
this->pointArry1.assign(tem.pointArry1.begin(), tem.pointArry1.end());
this->pointArry2.assign(tem.pointArry2.begin(), tem.pointArry2.end());
this->pointArry3.assign(tem.pointArry3.begin(), tem.pointArry3.end());
this->pointArry4.assign(tem.pointArry4.begin(), tem.pointArry4.end());
this->pointArry5.assign(tem.pointArry5.begin(), tem.pointArry5.end());
}
void ToMaskImg(int img_W, int img_H)
{
if (img_W > 0 && img_H > 0)
{
if (!shieldMask.empty())
{
shieldMask.release();
}
if (!bOpen)
{
return;
}
if (pointArry1.size() > 0 ||
pointArry2.size() > 0 ||
pointArry3.size() > 0 ||
pointArry4.size() > 0 ||
pointArry5.size() > 0)
{
bHave = true;
shieldMask = cv::Mat(img_H, img_W, CV_8U, cv::Scalar(0));
}
if (pointArry1.size() > 0)
{
cv::fillPoly(shieldMask, pointArry1, cv::Scalar(255));
}
if (pointArry2.size() > 0)
{
cv::fillPoly(shieldMask, pointArry2, cv::Scalar(255));
}
if (pointArry3.size() > 0)
{
cv::fillPoly(shieldMask, pointArry3, cv::Scalar(255));
}
if (pointArry4.size() > 0)
{
cv::fillPoly(shieldMask, pointArry4, cv::Scalar(255));
}
if (pointArry5.size() > 0)
{
cv::fillPoly(shieldMask, pointArry5, cv::Scalar(255));
}
}
}
void print(std::string str)
{
printf("%s>>bOpen %d bDraw %d bHave %d maskimg empty %d\n", str.c_str(),
bOpen, bDraw, bHave, shieldMask.empty());
}
std::string GetInfo(std::string str)
{
char buffer[128];
sprintf(buffer, "%s>>bOpen %d bDraw %d bHave %d maskimg empty %d\n", str.c_str(),
bOpen, bDraw, bHave, shieldMask.empty());
std::string str123 = buffer;
return str123;
}
};
// 启用127cell 独立检测
struct Function_Det_127_Cell
{
bool bOpen; // 是否开启
Function_Det_127_Cell()
{
Init();
}
void Init()
{
bOpen = false;
}
void copy(Function_Det_127_Cell tem)
{
this->bOpen = tem.bOpen;
}
void print(std::string str)
{
printf("%s>>bOpen %d \n", str.c_str(), bOpen);
}
std::string GetInfo(std::string str)
{
char buffer[64];
sprintf(buffer, "%s>>bOpen %d\n", str.c_str(), bOpen);
std::string str123 = buffer;
return str123;
}
};
// 检测roi区域参数
struct Function_EdgeROI
{
bool bOpen; // 是否开启
bool Use_DrawROI; // 使用绘制ROI
bool Use_DetEdge; // 使用边缘检测
bool Use_AIEdge; // 使用AI检测
bool AI_Fail_UseDraw; // 如果AI 失败使用绘制;
int threshold_value; // 二值化值
int AI_Erode_Size; // AI 检测 腐蚀的半径。
cv::Mat EdgeMask; // 边缘区域图片
std::vector<cv::Point> pointArry1; // 区域点
Function_EdgeROI()
{
Init();
}
void Init()
{
bOpen = false;
Use_DrawROI = false;
Use_DetEdge = true;
Use_AIEdge = false;
AI_Fail_UseDraw = false;
threshold_value = 11;
AI_Erode_Size = 7;
pointArry1.clear();
pointArry1.shrink_to_fit();
if (!EdgeMask.empty())
{
EdgeMask.release();
}
}
void copy(Function_EdgeROI tem)
{
this->bOpen = tem.bOpen;
this->Use_DrawROI = tem.Use_DrawROI;
this->Use_DetEdge = tem.Use_DetEdge;
this->Use_AIEdge = tem.Use_AIEdge;
this->AI_Fail_UseDraw = tem.AI_Fail_UseDraw;
this->threshold_value = tem.threshold_value;
this->AI_Erode_Size = tem.AI_Erode_Size;
this->EdgeMask = tem.EdgeMask.clone();
this->pointArry1.assign(tem.pointArry1.begin(), tem.pointArry1.end());
}
void ToMaskImg(int img_W, int img_H)
{
if (img_W > 0 && img_H > 0)
{
if (!EdgeMask.empty())
{
EdgeMask.release();
}
if (!bOpen)
{
return;
}
// if (!Use_DrawROI)
// {
// return;
// }
EdgeMask = cv::Mat(img_H, img_W, CV_8U, cv::Scalar(0));
if (pointArry1.size() > 0)
{
cv::fillPoly(EdgeMask, pointArry1, cv::Scalar(255));
}
else
{
printf("pointArry1 == 0 \n\n\n");
}
}
}
void print(std::string str)
{
printf("%s>>bOpen %d Use_DrawROI %d Use_DetEdge %d Use_AIEdge %d AI_Fail_UseDraw %d threshold_value %d AI_Erode_Size %d EdgeMask empty %d\n", str.c_str(),
bOpen, Use_DrawROI, Use_DetEdge, Use_AIEdge, AI_Fail_UseDraw, threshold_value, AI_Erode_Size, EdgeMask.empty());
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s>>bOpen %d Use_DrawROI %d Use_DetEdge %d Use_AIEdge %d AI_Fail_UseDraw %d threshold_value %d AI_Erode_Size %d EdgeMask empty %d\n", str.c_str(),
bOpen, Use_DrawROI, Use_DetEdge, Use_AIEdge, AI_Fail_UseDraw, threshold_value, AI_Erode_Size, EdgeMask.empty());
std::string str123 = buffer;
return str123;
}
};
// 图片对齐功能
struct Function_Image_Align
{
enum RunType
{
type_Use, // 使用
type_Test, // 仅测试
};
bool bOpen; // 是否开启
bool bDraw; // 是否绘制
float fscore; // 定位分数
RunType runType; // 运行模式
cv::Rect search_Roi; // 搜索区域
cv::Rect feature_Roi; // 特征区域
cv::Mat feature_Mask; // 特征mask
cv::Rect Crop_Roi; // 产品裁切区域
std::vector<cv::Point> pointArry1; // 特征区域点
Function_Image_Align()
{
Init();
}
void Init()
{
bOpen = false;
bDraw = false;
fscore = 0.9;
search_Roi = cv::Rect(0, 0, 0, 0);
feature_Roi = cv::Rect(0, 0, 0, 0);
Crop_Roi = cv::Rect(0, 0, 0, 0);
pointArry1.clear();
pointArry1.shrink_to_fit();
if (!feature_Mask.empty())
{
feature_Mask.release();
}
runType = type_Use;
}
// 将枚举值转换为字符串
std::string colorToString(RunType c)
{
switch (c)
{
case type_Use:
return "Use";
case type_Test:
return "Test";
default:
return "Use";
}
}
void copy(Function_Image_Align tem)
{
this->bOpen = tem.bOpen;
this->bDraw = tem.bDraw;
this->fscore = tem.fscore;
this->search_Roi = tem.search_Roi;
this->feature_Roi = tem.feature_Roi;
this->Crop_Roi = tem.Crop_Roi;
this->feature_Mask = tem.feature_Mask.clone();
this->pointArry1.assign(tem.pointArry1.begin(), tem.pointArry1.end());
this->runType = tem.runType;
}
void ToMaskImg(int img_W, int img_H)
{
if (img_W > 0 && img_H > 0)
{
if (!feature_Mask.empty())
{
feature_Mask.release();
}
if (!bOpen)
{
return;
}
// cv::Rect boundingRect = cv::boundingRect(pointArry1);
// feature_Roi = boundingRect;
// for (int i = 0; i < pointArry1.size(); i++)
// {
// pointArry1[i].x -= boundingRect.x;
// pointArry1[i].y -= boundingRect.y;
// }
cv::Mat tem_feature_Mask = cv::Mat(img_H, img_W, CV_8U, cv::Scalar(0));
if (pointArry1.size() > 0)
{
cv::fillPoly(tem_feature_Mask, pointArry1, cv::Scalar(255));
}
else
{
printf("pointArry1 == 0 \n\n\n");
}
feature_Mask = tem_feature_Mask(feature_Roi).clone();
}
}
void print(std::string str)
{
printf("%s>>bOpen %d bDraw %d fscore %f feature_Mask empty %d run type = %s\n", str.c_str(),
bOpen, bDraw, fscore, feature_Mask.empty(), colorToString(runType).c_str());
}
std::string GetInfo(std::string str)
{
char buffer[128];
sprintf(buffer, "%s>>bOpen %d bDraw %d fscore %f feature_Mask empty %d run type = %s\n", str.c_str(),
bOpen, bDraw, fscore, feature_Mask.empty(), colorToString(runType).c_str());
std::string str123 = buffer;
return str123;
}
};
// 缺失Pol检测
struct Function_Detect_LackPol
{
bool bOpen; // 是否开启
Function_Detect_LackPol()
{
Init();
}
void Init()
{
bOpen = false;
}
void copy(Function_Detect_LackPol tem)
{
this->bOpen = tem.bOpen;
}
void print(std::string str)
{
printf("%s>>bOpen %d \n", str.c_str(),
bOpen);
}
std::string GetInfo(std::string str)
{
char buffer[128];
sprintf(buffer, "%s>>bOpen %d\n", str.c_str(),
bOpen);
std::string str123 = buffer;
return str123;
}
};
// 二次精确检测
struct Function_SecondDet
{
bool bOpen; // 是否开启
bool andian_Open_area; // 暗点 开启面积检测
bool andian_Open_len; // 暗点 开启长度检测
float andian_area_min; // 暗点 面积范围
float andian_area_max; // 暗点 面积范围
bool andian_saveProcessImg; // 暗点 存储图片
bool pol_Open_area; // pol 开启面积检测
bool pol_Open_len; // pol 开启长度检测
float pol_area_min; // pol 面积范围
float pol_area_max; // pol 面积范围
bool pol_open_SingleCheck; // pol 开启独立参数分析
bool pol_open_Create; // pol 可以生成新异物
bool pol_saveProcessImg; // pol 存储图片
Function_SecondDet()
{
Init();
}
void Init()
{
bOpen = false;
andian_Open_area = false;
andian_Open_len = false;
andian_area_min = 0;
andian_area_max = 0.25;
andian_saveProcessImg = false;
pol_Open_area = false;
pol_Open_len = false;
pol_area_min = 0;
pol_area_max = 0.25;
pol_open_SingleCheck = false;
pol_open_Create = false;
pol_saveProcessImg = false;
}
void copy(Function_SecondDet tem)
{
this->bOpen = tem.bOpen;
this->andian_Open_area = tem.andian_Open_area;
this->andian_Open_len = tem.andian_Open_len;
this->andian_area_min = tem.andian_area_min;
this->andian_area_max = tem.andian_area_max;
this->andian_saveProcessImg = tem.andian_saveProcessImg;
this->pol_Open_area = tem.pol_Open_area;
this->pol_Open_len = tem.pol_Open_len;
this->pol_area_min = tem.pol_area_min;
this->pol_area_max = tem.pol_area_max;
this->pol_open_SingleCheck = tem.pol_open_SingleCheck;
this->pol_open_Create = tem.pol_open_Create;
this->pol_saveProcessImg = tem.pol_saveProcessImg;
}
void print(std::string str)
{
printf("%s>>bOpen %d andian : Open_area %d Open_len %d bsaveimg %d area_minmax %f-%f\n", str.c_str(),
bOpen, andian_Open_area, andian_Open_len, andian_saveProcessImg, andian_area_min, andian_area_max);
printf("%s>>bOpen %d pol : Open_area %d Open_len %d bsaveimg %d area_minmax %f-%f singlecheck %d create %d\n", str.c_str(),
bOpen, pol_Open_area, pol_Open_len, pol_saveProcessImg, pol_area_min, pol_area_max, pol_open_SingleCheck, pol_open_Create);
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s>>bOpen %d andian : Open_area %d Open_len %d bsaveimg %d area_minmax %f-%f pol : Open_area %d Open_len %d bsaveimg %d area_minmax %f-%f singlecheck %d create %d\n", str.c_str(),
bOpen, andian_Open_area, andian_Open_len, andian_saveProcessImg, andian_area_min, andian_area_max,
pol_Open_area, pol_Open_len, pol_saveProcessImg, pol_area_min, pol_area_max, pol_open_SingleCheck, pol_open_Create);
std::string str123 = buffer;
return str123;
}
};
// 暗点的 S标准
struct AD_S_Standard
{
float area; // 面积
float len; // 长度
AD_S_Standard()
{
Init();
}
void Init()
{
area = 0;
len = 0;
}
void copy(AD_S_Standard tem)
{
this->area = tem.area;
this->len = tem.len;
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s:area %f len %f;", str.c_str(),
area, len);
std::string str123 = buffer;
return str123;
}
};
// 暗点数量分析
struct AD_Analysisy_Num
{
bool bOpen; // 是否开启
int numT; // 数量阈值
AD_Analysisy_Num()
{
Init();
}
void Init()
{
bOpen = false;
numT = 0;
}
void copy(AD_Analysisy_Num tem)
{
this->bOpen = tem.bOpen;
this->numT = tem.numT;
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s:bOpen %d num %d;", str.c_str(),
bOpen, numT);
std::string str123 = buffer;
return str123;
}
};
// 暗点距离分析
struct AD_Analysisy_Dis
{
bool bOpen; // 是否开启
float disT; // 距离阈值
AD_Analysisy_Dis()
{
Init();
}
void Init()
{
bOpen = false;
disT = 0;
}
void copy(AD_Analysisy_Dis tem)
{
this->bOpen = tem.bOpen;
this->disT = tem.disT;
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s:bOpen %d dis %f;", str.c_str(),
bOpen, disT);
std::string str123 = buffer;
return str123;
}
};
// 暗点S标准分析
struct AD_Analysisy_S
{
bool bOpen; // 是否开启
bool NG_3s; // 直接NG 的 3S 值。
int Check_s_Value; // 有数量数量要求的s值。
int Check_s_Num; // 数量要求。
AD_Analysisy_S()
{
Init();
}
void Init()
{
bOpen = false;
NG_3s = false;
Check_s_Value = 2;
Check_s_Num = 2;
}
void copy(AD_Analysisy_S tem)
{
this->bOpen = tem.bOpen;
this->NG_3s = tem.NG_3s;
this->Check_s_Value = tem.Check_s_Value;
this->Check_s_Num = tem.Check_s_Num;
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s:bOpen %d s_Value %d s_Num %d NG_3s %d;", str.c_str(),
bOpen, Check_s_Value, Check_s_Num, NG_3s);
std::string str123 = buffer;
return str123;
}
};
// 暗点检测功能
struct Function_AD_Check
{
bool bOpen; // 是否开启
AD_S_Standard S_standard_3s; // 3s 标准
AD_S_Standard S_standard_2s; // 2s 标准
AD_S_Standard S_standard_1s; // 1s 标准
AD_Analysisy_Num analysis_num; // 数量分析
AD_Analysisy_Dis analysis_dis; // 距离分析
AD_Analysisy_S analysis_s; // s 标准分析
Function_AD_Check()
{
Init();
}
void Init()
{
bOpen = false;
S_standard_3s.Init();
S_standard_2s.Init();
S_standard_1s.Init();
analysis_num.Init();
analysis_dis.Init();
analysis_s.Init();
}
void copy(Function_AD_Check tem)
{
this->bOpen = tem.bOpen;
this->S_standard_3s.copy(tem.S_standard_3s);
this->S_standard_2s.copy(tem.S_standard_2s);
this->S_standard_1s.copy(tem.S_standard_1s);
this->analysis_num.copy(tem.analysis_num);
this->analysis_dis.copy(tem.analysis_dis);
this->analysis_s.copy(tem.analysis_s);
}
void print(std::string str)
{
printf("%s>>bOpen %d %s %s %s %s %s %s\n", str.c_str(),
bOpen, S_standard_3s.GetInfo("3S").c_str(),
S_standard_2s.GetInfo("2S").c_str(),
S_standard_1s.GetInfo("1S").c_str(),
analysis_num.GetInfo("analysis_num").c_str(),
analysis_dis.GetInfo("analysis_dis").c_str(),
analysis_s.GetInfo("analysis_s").c_str());
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s>>bOpen %d ", str.c_str(), bOpen);
std::string str123 = buffer;
str123 += S_standard_3s.GetInfo("3S");
str123 += S_standard_2s.GetInfo("2S");
str123 += S_standard_1s.GetInfo("1S");
str123 += analysis_num.GetInfo("analysis_num");
str123 += analysis_dis.GetInfo("analysis_dis");
str123 += analysis_s.GetInfo("analysis_s");
return str123;
}
};
// 异物检测功能
struct Function_POL_Check
{
bool bOpen; // 是否开启
int numT; // 数量阈值
Function_POL_Check()
{
Init();
}
void Init()
{
bOpen = false;
numT = 0;
}
void copy(Function_POL_Check tem)
{
this->bOpen = tem.bOpen;
this->numT = tem.numT;
}
void print(std::string str)
{
printf("%s>>bOpen %d %d\n", str.c_str(),
bOpen,
numT);
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s>>bOpen %d num %d", str.c_str(), bOpen, numT);
std::string str123 = buffer;
return str123;
}
};
// Mark 边缘检测功能
struct Function_Edge_Det
{
enum Edge_type
{
Edge_type_Add,
Edge_type_And,
Edge_type_useEdge,
};
bool bOpen; // 是否开启
bool bshowRoi;
int type; // 边缘检测类型
bool bsave_all;
bool bsave_qx;
bool bdetUse; // 开启排废
Function_Edge_Det()
{
Init();
}
void Init()
{
bshowRoi = false;
bOpen = false;
type = Edge_type_Add;
bsave_all = false;
bsave_qx = false;
bdetUse = false;
}
void copy(Function_Edge_Det tem)
{
this->bOpen = tem.bOpen;
this->bshowRoi = tem.bshowRoi;
this->type = tem.type;
this->bsave_all = tem.bsave_all;
this->bsave_qx = tem.bsave_qx;
this->bdetUse = tem.bdetUse;
}
void print(std::string str)
{
printf("%s>>bOpen %d bdetUse %d bshow %d type %d bsave_all %d bsave_qx %d\n", str.c_str(), bOpen, bdetUse, bshowRoi,
type, bsave_all, bsave_qx);
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s>>bOpen %d bdetUse %d bshow %d type %d bsave_all %d bsave_qx %d\n", str.c_str(), bOpen, bdetUse, bshowRoi,
type, bsave_all, bsave_qx);
std::string str123 = buffer;
return str123;
}
};
// 检测功能
struct CheckFunction
{
Function_Base_Det f_BaseDet; // 基础检测
Function_Use_UP_QX f_UseUpQX; // 使用UP画面的缺陷进行过滤
Function_OnlyBLob f_OnlyBLob; // 只获取blob ,不进行分析
Function_YXDet f_YXDet; // 异显检测
Function_AI_QX f_AIQX; // 缺陷分类设置
Function_AI_LD f_LDConfig; // 亮点参数
Function_BigQX f_Big_QX;
Function_ShieldRegion f_ShieldRegion;
Function_Det_127_Cell f_Det127Cell;
Function_EdgeROI f_EdgeROI;
Function_Image_Align f_Image_Align; // 图片特征对齐
Function_Detect_LackPol f_Dectect_LackPol; // 缺失POL检测
Function_SecondDet f_SecondDetect; // 二次检测分析
Function_AD_Check f_AD_Check; // 暗点的检测功能
Function_POL_Check f_POL_Check; // 异物的检测功能
Function_Edge_Det f_dege_Det;
CheckFunction()
{
Init();
}
void Init()
{
f_UseUpQX.Init();
f_BaseDet.Init();
f_OnlyBLob.Init();
f_YXDet.Init();
f_AIQX.Init();
f_LDConfig.Init();
f_Big_QX.Init();
f_ShieldRegion.Init();
f_Det127Cell.Init();
f_EdgeROI.Init();
f_Image_Align.Init();
f_Dectect_LackPol.Init();
f_SecondDetect.Init();
f_AD_Check.Init();
f_POL_Check.Init();
f_dege_Det.Init();
}
void copy(CheckFunction tem)
{
this->f_UseUpQX.copy(tem.f_UseUpQX);
this->f_BaseDet.copy(tem.f_BaseDet);
this->f_OnlyBLob.copy(tem.f_OnlyBLob);
this->f_YXDet.copy(tem.f_YXDet);
this->f_AIQX.copy(tem.f_AIQX);
this->f_LDConfig.copy(tem.f_LDConfig);
this->f_Big_QX.copy(tem.f_Big_QX);
this->f_ShieldRegion.copy(tem.f_ShieldRegion);
this->f_Det127Cell.copy(tem.f_Det127Cell);
this->f_EdgeROI.copy(tem.f_EdgeROI);
this->f_Image_Align.copy(tem.f_Image_Align);
this->f_Dectect_LackPol.copy(tem.f_Dectect_LackPol);
this->f_SecondDetect.copy(tem.f_SecondDetect);
this->f_AD_Check.copy(tem.f_AD_Check);
this->f_POL_Check.copy(tem.f_POL_Check);
this->f_dege_Det.copy(tem.f_dege_Det);
}
void print(std::string str)
{
printf("%s>>\n", str.c_str());
f_BaseDet.print("BaseDet");
f_UseUpQX.print("UseUpQX");
f_OnlyBLob.print("OnlyBLob");
f_YXDet.print("YXDet");
f_AIQX.print("AIQX");
f_LDConfig.print("LDConfig");
f_Big_QX.print("Big_QX");
f_ShieldRegion.print("ShieldRegion");
f_Det127Cell.print("Det127Cell");
f_EdgeROI.print("EdgeROI");
f_Image_Align.print("Image_Align");
f_Dectect_LackPol.print("Dectect_LackPol");
f_SecondDetect.print("SecondDetect");
f_AD_Check.print("f_AD_Check");
f_POL_Check.print("f_POL_Check");
f_dege_Det.print("f_dege_Det");
}
std::string GetInfo(std::string str)
{
std::string str123 = str + ":\n";
str123 += f_BaseDet.GetInfo("BaseDet");
str123 += f_UseUpQX.GetInfo("UseUpQX");
str123 += f_OnlyBLob.GetInfo("f_OnlyBLob");
str123 += f_YXDet.GetInfo("YXDet");
str123 += f_AIQX.GetInfo("AIQX");
str123 += f_LDConfig.GetInfo("LDConfig");
str123 += f_Big_QX.GetInfo("Big_QX");
str123 += f_ShieldRegion.GetInfo("ShieldRegion");
str123 += f_Det127Cell.GetInfo("Det127Cell");
str123 += f_EdgeROI.GetInfo("EdgeROI");
str123 += f_Image_Align.GetInfo("Image_Align");
str123 += f_Dectect_LackPol.GetInfo("Dectect_LackPol");
str123 += f_SecondDetect.GetInfo("SecondDetect");
str123 += f_AD_Check.GetInfo("f_AD_Check");
str123 += f_POL_Check.GetInfo("f_POL_Check");
str123 += f_dege_Det.GetInfo("f_dege_Det");
return str123;
}
};
// 单通道检测功能
struct ChannelCheckFunction
{
std::string strChannelName;
CheckFunction function; // 使用UP画面的缺陷进行过滤
ChannelCheckFunction()
{
Init();
}
void Init()
{
strChannelName = "";
function.Init();
}
void copy(ChannelCheckFunction tem)
{
this->strChannelName = tem.strChannelName;
this->function.copy(tem.function);
}
void print(std::string str)
{
printf("%s>> %s\n", str.c_str(), strChannelName.c_str());
function.print("function");
}
std::string GetInfo(std::string str)
{
std::string str123 = "";
str123 += strChannelName + ":\n";
str123 += function.GetInfo("function");
// str123 += "\n";
return str123;
}
};
// 基础检测功能 mark
struct Base_Function_MarkLine
{
bool bOpen; // 是否开启
cv::Rect searchRoi; // mark的搜索区域
int x_sheild_width;
int y_sheild_width;
bool bUse_Roi_Sheild; // 是否开启区域屏蔽
bool bUse_qx_Sheild; // 是否开启缺陷屏蔽
std::vector<std::string> sheil_qx_List; // 屏蔽缺陷list
float qx_sheild_iou; // 屏蔽iou
Base_Function_MarkLine()
{
Init();
}
void Init()
{
bOpen = false;
searchRoi = cv::Rect(0, 0, 0, 0);
x_sheild_width = 0;
y_sheild_width = 0;
bUse_Roi_Sheild = false;
bUse_qx_Sheild = false;
sheil_qx_List.clear();
sheil_qx_List.shrink_to_fit();
qx_sheild_iou = 0.1;
}
void copy(Base_Function_MarkLine tem)
{
this->bOpen = tem.bOpen;
this->searchRoi = tem.searchRoi;
this->x_sheild_width = tem.x_sheild_width;
this->y_sheild_width = tem.y_sheild_width;
this->qx_sheild_iou = tem.qx_sheild_iou;
this->bUse_Roi_Sheild = tem.bUse_Roi_Sheild;
this->bUse_qx_Sheild = tem.bUse_qx_Sheild;
this->sheil_qx_List.assign(tem.sheil_qx_List.begin(), tem.sheil_qx_List.end());
}
void print(std::string str)
{
printf("%s>>bOpen %d bUse_Roi_Sheild %d bUse_qx_Sheild %d x_sheild_width %d y_sheild_width %d qx_sheild_iou %f search roi %d %d %d %d\n", str.c_str(),
bOpen, bUse_Roi_Sheild, bUse_qx_Sheild, x_sheild_width, y_sheild_width, qx_sheild_iou, searchRoi.x, searchRoi.y, searchRoi.width, searchRoi.height);
for (int i = 0; i < sheil_qx_List.size(); i++)
{
printf("%s ", sheil_qx_List.at(i).c_str());
}
printf(" \n");
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s>>bOpen %d bUse_Roi_Sheild %d bUse_qx_Sheild %d x_sheild_width %d y_sheild_width %d qx_sheild_iou %f search roi %d %d %d %d\n", str.c_str(),
bOpen, bUse_Roi_Sheild, bUse_qx_Sheild, x_sheild_width, y_sheild_width, qx_sheild_iou, searchRoi.x, searchRoi.y, searchRoi.width, searchRoi.height);
std::string str123 = buffer;
for (int i = 0; i < sheil_qx_List.size(); i++)
{
str123 += sheil_qx_List.at(i) + ";";
}
str123 += "\n";
return str123;
}
};
// 基础检测功能 存图设置
struct Base_Function_SaveImg
{
bool bOpen; // 是否开启
bool bSaveMarkImg; // mark 存图
bool bSaveClsImg; // 分类 存图
bool bSaveAlginImg; // 分类 存图
Base_Function_SaveImg()
{
Init();
}
void Init()
{
bOpen = false;
bSaveMarkImg = false;
bSaveClsImg = false;
bSaveAlginImg = false;
}
void copy(Base_Function_SaveImg tem)
{
this->bOpen = tem.bOpen;
this->bSaveMarkImg = tem.bSaveMarkImg;
this->bSaveClsImg = tem.bSaveClsImg;
this->bSaveAlginImg = tem.bSaveAlginImg;
}
void print(std::string str)
{
printf("%s>>bOpen %d bSaveMarkImg %d bSaveClsImg %d bSaveAlginImg %d \n", str.c_str(),
bOpen, bSaveMarkImg, bSaveClsImg, bSaveAlginImg);
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s>>bOpen %d bSaveMarkImg %d bSaveClsImg %d bSaveAlginImg %d \n", str.c_str(),
bOpen, bSaveMarkImg, bSaveClsImg, bSaveAlginImg);
std::string str123 = buffer;
return str123;
}
};
// 大缺陷 NG
struct Big_NG
{
bool bOpen; // 是否开启
float fArea;
std::string strname;
Big_NG()
{
Init();
}
void Init()
{
bOpen = false;
fArea = 1;
strname = "";
}
void copy(Big_NG tem)
{
this->bOpen = tem.bOpen;
this->fArea = tem.fArea;
this->strname = tem.strname;
}
void print(std::string str)
{
printf("%s>>bOpen %d strname %s fArea %f \n", str.c_str(),
bOpen, strname.c_str(), fArea);
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s>>bOpen %d strname %s fArea %f \n", str.c_str(),
bOpen, strname.c_str(), fArea);
std::string str123 = buffer;
return str123;
}
};
// 基础检测功能 大缺陷 NG
struct Base_Function_BigNG
{
bool bOpen; // 是否开启
bool usPreResult;
Big_NG qx[CONFIG_QX_NAME_count];
Base_Function_BigNG()
{
Init();
}
void Init()
{
bOpen = false;
usPreResult = true;
for (int i = 0; i < CONFIG_QX_NAME_count; i++)
{
qx[i].Init();
}
}
void copy(Base_Function_BigNG tem)
{
this->bOpen = tem.bOpen;
for (int i = 0; i < CONFIG_QX_NAME_count; i++)
{
this->qx[i].copy(tem.qx[i]);
}
}
void print(std::string str)
{
printf("%s>>bOpen %d \n", str.c_str(),
bOpen);
for (int i = 0; i < CONFIG_QX_NAME_count; i++)
{
printf("%s \n", qx[i].GetInfo("").c_str());
}
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s>>bOpen %d \n", str.c_str(),
bOpen);
std::string str123 = buffer;
for (int i = 0; i < CONFIG_QX_NAME_count; i++)
{
str123 += qx[i].GetInfo("");
}
return str123;
}
};
// 基础功能 边缘检测通道,
struct Base_Function_EdgeChannel
{
bool bOpen; // 是否开启
std::string strChannel;
Base_Function_EdgeChannel()
{
Init();
}
void Init()
{
bOpen = false;
strChannel = "L255";
}
void copy(Base_Function_EdgeChannel tem)
{
this->bOpen = tem.bOpen;
this->strChannel = tem.strChannel;
}
void print(std::string str)
{
printf("%s>>bOpen %d Channel Name %s \n", str.c_str(),
bOpen, strChannel.c_str());
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s>>bOpen %d Channel Name %s \n", str.c_str(),
bOpen, strChannel.c_str());
std::string str123 = buffer;
return str123;
}
};
// 基础检测功能 CELL AOI 边缘缺陷检测
struct Base_Function_Edge_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()
{
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());
bDrawResult = false;
}
void copy(Base_Function_Edge_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->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);
}
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);
std::string str123 = buffer;
return str123;
}
};
// 暗点检测功能
struct Base_Function_AD_Check
{
bool bOpen; // 是否开启
AD_S_Standard S_standard_3s; // 3s 标准
AD_S_Standard S_standard_2s; // 2s 标准
AD_S_Standard S_standard_1s; // 1s 标准
AD_Analysisy_Num analysis_num; // 数量分析
AD_Analysisy_Dis analysis_dis; // 距离分析
AD_Analysisy_S analysis_s; // s 标准分析
Base_Function_AD_Check()
{
Init();
}
void Init()
{
bOpen = false;
S_standard_3s.Init();
S_standard_2s.Init();
S_standard_1s.Init();
analysis_num.Init();
analysis_dis.Init();
analysis_s.Init();
}
void copy(Base_Function_AD_Check tem)
{
this->bOpen = tem.bOpen;
this->S_standard_3s.copy(tem.S_standard_3s);
this->S_standard_2s.copy(tem.S_standard_2s);
this->S_standard_1s.copy(tem.S_standard_1s);
this->analysis_num.copy(tem.analysis_num);
this->analysis_dis.copy(tem.analysis_dis);
this->analysis_s.copy(tem.analysis_s);
}
void print(std::string str)
{
printf("%s>>bOpen %d %s %s %s %s %s %s\n", str.c_str(),
bOpen, S_standard_3s.GetInfo("3S").c_str(),
S_standard_2s.GetInfo("2S").c_str(),
S_standard_1s.GetInfo("1S").c_str(),
analysis_num.GetInfo("analysis_num").c_str(),
analysis_dis.GetInfo("analysis_dis").c_str(),
analysis_s.GetInfo("analysis_s").c_str());
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s>>bOpen %d ", str.c_str(), bOpen);
std::string str123 = buffer;
str123 += S_standard_3s.GetInfo("3S");
str123 += S_standard_2s.GetInfo("2S");
str123 += S_standard_1s.GetInfo("1S");
str123 += analysis_num.GetInfo("analysis_num");
str123 += analysis_dis.GetInfo("analysis_dis");
str123 += analysis_s.GetInfo("analysis_s");
return str123;
}
};
// 基础检测功能
struct BaseCheckFunction
{
Base_Function_MarkLine markLine;
Base_Function_Edge_Det edgeDet;
Base_Function_SaveImg saveImg;
Base_Function_BigNG bigNG;
Base_Function_EdgeChannel edgeChannel;
Base_Function_AD_Check ad_check;
BaseCheckFunction()
{
Init();
}
void Init()
{
markLine.Init();
edgeDet.Init();
saveImg.Init();
bigNG.Init();
edgeChannel.Init();
ad_check.Init();
}
void copy(BaseCheckFunction tem)
{
this->markLine.copy(tem.markLine);
this->edgeDet.copy(tem.edgeDet);
this->saveImg.copy(tem.saveImg);
this->bigNG.copy(tem.bigNG);
this->edgeChannel.copy(tem.edgeChannel);
this->ad_check.copy(tem.ad_check);
}
void print(std::string str)
{
printf("******* %s *********\n", str.c_str());
markLine.print("markLine");
edgeDet.print("edgeDet");
saveImg.print("saveImg");
bigNG.print("bigNG");
edgeChannel.print("edgeChannel");
ad_check.print("ad_check");
}
std::string GetInfo(std::string str)
{
std::string str123 = "";
str123 += markLine.GetInfo("markLine");
str123 += edgeDet.GetInfo("edgeDet");
str123 += saveImg.GetInfo("saveImg");
str123 += bigNG.GetInfo("bigNG");
str123 += edgeChannel.GetInfo("edgeChannel");
str123 += ad_check.GetInfo("ad_check");
// str123 += "\n";
return str123;
}
};
// 所有通道检测功能
struct ALLChannelCheckFunction
{
std::vector<ChannelCheckFunction> channelFunctionArr; // 所有通道的参数。
ALLChannelCheckFunction()
{
Init();
}
void Init()
{
channelFunctionArr.clear();
channelFunctionArr.shrink_to_fit();
}
void copy(ALLChannelCheckFunction tem)
{
this->channelFunctionArr.assign(tem.channelFunctionArr.begin(), tem.channelFunctionArr.end());
}
void print(std::string str)
{
printf("%s===========================\n", str.c_str());
for (int i = 0; i < channelFunctionArr.size(); i++)
{
channelFunctionArr.at(i).print("");
}
printf("%s===========================\n", str.c_str());
}
};
// 和相机相关的分析参数
struct AnalysisyConfigST
{
std::string strSkuName;
CommonCheckConfigST commonCheckConfig; // 和图片相关的参数
ALLChannelCheckFunction checkFunction; // 每个通道的检测功能
BaseCheckFunction baseFunction; // 检测检测的function
AnalysisyConfigST()
{
strSkuName = "";
}
void copy(AnalysisyConfigST tem)
{
this->strSkuName = tem.strSkuName;
this->commonCheckConfig.copy(tem.commonCheckConfig);
this->checkFunction.copy(tem.checkFunction);
this->baseFunction.copy(tem.baseFunction);
}
void print(std::string str)
{
printf("%s=============AnalysisyConfigST==============\n", str.c_str());
checkFunction.print("checkFunction");
baseFunction.print("baseFunction");
printf("%s============AnalysisyConfigST===============\n", str.c_str());
}
};
// 金佰利 图片亮度值 参数 后来添加的
struct ImgBrightnessROIConfig
{
bool bcheck;
cv::Rect imageBrightnessROI; // 图像亮度检测区域
int minthreshold; // 最小灰度阈值
int maxthreshold; // 最大灰度阈值
int alarmSheet; // 检测张数
ImgBrightnessROIConfig()
{
bcheck = false;
imageBrightnessROI = cv::Rect(0, 0, 0, 0);
minthreshold = 0;
maxthreshold = 0;
alarmSheet = 0;
}
void copy(ImgBrightnessROIConfig tem)
{
this->bcheck = tem.bcheck;
this->imageBrightnessROI = tem.imageBrightnessROI;
this->maxthreshold = tem.maxthreshold;
this->minthreshold = tem.minthreshold;
this->alarmSheet = tem.alarmSheet;
}
};
// 预处理图片参数信息
struct PreDealImgConfig
{
// 图片预处理:
// 1cut到指定大小
// 2、bresize = true, 缩放到模型输入图片尺寸大小
// 3、bInAI_ImgFflip 输入模型的图片是否要 水平翻转
// 4、bOutAI_ImgFflip 模型输出的图片是否要 水平翻转
cv::Rect cutRoi; // 图片裁剪区域信息
bool bresize; // 是否要resize 到模型输入图尺寸大小
bool bInAI_ImgFflip; // 模型输入的图片是否翻转
bool bOutAI_ImgFflip; // 模型输出的图片是否翻转
PreDealImgConfig()
{
cutRoi.x = 0;
cutRoi.y = 0;
cutRoi.width = 0;
cutRoi.height = 0;
bInAI_ImgFflip = false;
bOutAI_ImgFflip = false;
bresize = false;
}
void copy(PreDealImgConfig tem)
{
this->cutRoi.x = tem.cutRoi.x;
this->cutRoi.y = tem.cutRoi.y;
this->cutRoi.width = tem.cutRoi.width;
this->cutRoi.height = tem.cutRoi.height;
this->bInAI_ImgFflip = tem.bInAI_ImgFflip;
this->bOutAI_ImgFflip = tem.bOutAI_ImgFflip;
this->bresize = tem.bresize;
}
};
// 检测基本参数,包括基本信息,和深度学习模型路径参数
struct CheckConfigST
{
ImageInfo Srcimg_in;
ImageInfo resultimg_out;
PreDealImgConfig preDealImgConfig;
ModelConfigST modelConfig; // 深度模型参数
CAM_CONFIGINFO_ camConfig;
CheckConfigST()
{
}
void copy(CheckConfigST tem)
{
this->preDealImgConfig.copy(tem.preDealImgConfig);
this->modelConfig.copy(tem.modelConfig);
this->Srcimg_in.copy(tem.Srcimg_in);
this->resultimg_out.copy(tem.resultimg_out);
this->camConfig.copy(tem.camConfig);
}
};
struct BLobResult
{
int nresult; // 最后的结果
cv::Rect roi; // 位置
int AI_qx_type; // 缺陷类型,
int area; // Blob- 面积
int energy; // Blob-能量
float JudgArea; // Blob- 调整后的面积 平方毫米
float len; // Blob- 长度
int maxValue; // Blob- 最大亮度
float grayDis; // Blob- 灰阶
float density; // Blob- 密度
BLobResult()
{
Init();
}
void Init()
{
nresult = 0; // 最后的结果
roi = {0, 0, 0, 0}; // 位置
AI_qx_type = 0; // 缺陷类型,
area = 0; // Blob- 面积
energy = 0; // Blob-能量
JudgArea = 0; // Blob- 调整后的面积 平方毫米
len = 0; // Blob- 长度
maxValue = 0; // Blob- 最大亮度
grayDis = 0; // Blob- 灰阶
density = 0; // Blob- 密度
}
};
// 检测结果
struct DetResultST
{
std::vector<BLobResult> BLobResultList;
DetResultST()
{
Init();
}
void Init()
{
BLobResultList.erase(BLobResultList.begin(), BLobResultList.end());
BLobResultList.clear();
}
void copy(DetResultST tem)
{
this->BLobResultList.assign(tem.BLobResultList.begin(), tem.BLobResultList.end());
}
};
#endif //_CORELOGICFACTORY_HPP_