@ -469,6 +469,7 @@ struct BasicConfig
height_max = 999999 ;
bDrawShieldRoi = false ;
bShield_ZF = false ;
bShield_BQ = true ;
bDrawPreRoi = false ;
fUP_IOU = 0.9 ;
bCal_ImageScale = false ;
@ -797,6 +798,7 @@ struct Function_YXDet
{
bool bOpen ; // 是否开启
std : : string strModle ;
int minArea ;
Function_YXDet ( )
{
Init ( ) ;
@ -805,20 +807,22 @@ struct Function_YXDet
{
bOpen = false ;
strModle = " " ;
minArea = 0 ;
}
void copy ( Function_YXDet tem )
{
this - > bOpen = tem . bOpen ;
this - > strModle = tem . strModle ;
this - > minArea = tem . minArea ;
}
void print ( std : : string str )
{
// printf("%s>>bOpen %d strModle %s \n", str.c_str(), bOpen, strModle.c_str());
// printf("%s>>bOpen %d strModle %s minArea %d \n", str.c_str(), bOpen, strModle.c_str(), minArea );
}
std : : string GetInfo ( std : : string str )
{
char buffer [ 64 ] ;
sprintf ( buffer , " %s>>bOpen %d strModle %s \n " , str . c_str ( ) , bOpen , strModle . c_str ( ) ) ;
sprintf ( buffer , " %s>>bOpen %d strModle %s minArea %d \n " , str . c_str ( ) , bOpen , strModle . c_str ( ) , minArea ) ;
std : : string str123 = buffer ;
return str123 ;
}
@ -1290,8 +1294,19 @@ struct Function_Image_Align
{
printf ( " pointArry1 == 0 \n \n \n " ) ;
}
feature_Roi = feature_Roi & cv : : Rect ( 0 , 0 , img_W , img_H ) ;
feature_Mask = tem_feature_Mask ( feature_Roi ) . clone ( ) ;
// 防御: feature_Roi 相对图像尺寸 img_W x img_H 可能越界,
// 越界会导致 cv::Mat(Mat, Rect) 断言失败并抛 cv::Exception, 进而 abort。
cv : : Rect roi = feature_Roi & cv : : Rect ( 0 , 0 , img_W , img_H ) ;
if ( roi . width < = 0 | | roi . height < = 0 )
{
printf ( " [ToMaskImg] WARNING feature_Roi (%d,%d,%d,%d) out of range, img %dx%d \n " ,
feature_Roi . x , feature_Roi . y , feature_Roi . width , feature_Roi . height , img_W , img_H ) ;
feature_Mask = tem_feature_Mask . clone ( ) ;
}
else
{
feature_Mask = tem_feature_Mask ( roi ) . clone ( ) ;
}
}
}
void print ( std : : string str )
@ -1567,74 +1582,80 @@ struct AD_Analysisy_IOU
return str123 ;
}
} ;
// 暗点检测功能
struct Function_AD_Check
struct AD_Analysisy_Bind
{
bool bUse ;
std : : vector < std : : string > main_channel_2s ;
std : : vector < std : : string > second_channel_2s ;
std : : vector < std : : string > main_channel_3s ;
std : : vector < std : : string > second_channel_3s ;
std : : vector < std : : string > correlated_channels ;
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 标准分析
AD_Analysisy_IOU analysis_iou ; // IOU 分析
Function_AD_Check ( )
AD_Analysisy_Bind ( )
{
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 ( ) ;
analysis_iou . 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 ) ;
this - > analysis_iou . copy ( tem . analysis_iou ) ;
bUse = false ;
main_channel_2s . clear ( ) ;
second_channel_2s . clear ( ) ;
main_channel_3s . clear ( ) ;
second_channel_3s . clear ( ) ;
correlated_channels . clear ( ) ;
}
void print( std : : string str )
void copy ( AD_Analysisy_Bind tem )
{
printf ( " %s>>bOpen %d %s %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 ( ) ,
analysis_iou . GetInfo ( " analysis_iou " ) . c_str ( ) ) ;
this - > bUse = tem . bUse ;
this - > main_channel_2s = tem . main_channel_2s ;
this - > second_channel_2s = tem . second_channel_2s ;
this - > main_channel_3s = tem . main_channel_3s ;
this - > second_channel_3s = tem . second_channel_3s ;
this - > correlated_channels = tem . correlated_channels ;
}
std : : string GetInfo ( std : : string str )
{
char buffer [ 256 ] ;
sprintf ( buffer , " %s>>bOpen %d " , str . c_str ( ) , bOpen ) ;
sprintf ( buffer , " %s:bUse %d; " , str . c_str ( ) ,
bUse ) ;
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 " ) ;
str123 + = analysis_iou . GetInfo ( " analysis_iou " ) ;
return str123 ;
}
} ;
struct AD_Analysisy_SF
{
std : : vector < std : : string > s_sf ;
std : : vector < std : : string > region_sf ;
AD_Analysisy_SF ( )
{
Init ( ) ;
}
void Init ( )
{
s_sf . clear ( ) ;
region_sf . clear ( ) ;
}
void copy ( AD_Analysisy_SF tem )
{
this - > s_sf = tem . s_sf ;
this - > region_sf = tem . region_sf ;
}
std : : string GetInfo ( std : : string str )
{
std : : string str123 ;
for ( int i = 0 ; i < s_sf . size ( ) ; i + + )
{
str123 + = str + " :s_sf " + s_sf [ i ] + " ; " ;
}
for ( int i = 0 ; i < region_sf . size ( ) ; i + + )
{
str123 + = str + " :region_sf " + region_sf [ i ] + " ; " ;
}
return str123 ;
}
} ;
// 异物检测功能
struct Function_POL_Check
{
@ -1723,6 +1744,44 @@ struct Function_Edge_Det
return str123 ;
}
} ;
struct Function_Det_BQ
{
bool bBQ_AI_Det ; // 是否启用标签独立AI检测
int BQ_expand ;
bool bsaveAll ;
Function_Det_BQ ( )
{
Init ( ) ;
}
void Init ( )
{
BQ_expand = 0 ;
bBQ_AI_Det = false ;
bsaveAll = false ;
}
void copy ( Function_Det_BQ tem )
{
this - > BQ_expand = tem . BQ_expand ;
this - > bBQ_AI_Det = tem . bBQ_AI_Det ;
this - > bsaveAll = tem . bsaveAll ;
}
void print ( std : : string str )
{
printf ( " %d BQ_expand %d bBQ_AI_Det %d bsaveAll %d \n " , str . c_str ( ) ,
BQ_expand , bBQ_AI_Det , bsaveAll ) ;
}
std : : string GetInfo ( std : : string str )
{
char buffer [ 256 ] ;
sprintf ( buffer , " %d BQ_expand %d bBQ_AI_Det %d bsaveAll %d \n " , str . c_str ( ) ,
BQ_expand , bBQ_AI_Det , bsaveAll ) ;
std : : string str123 = buffer ;
return str123 ;
}
} ;
// 检测功能
struct CheckFunction
{
@ -1739,9 +1798,9 @@ struct CheckFunction
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 ;
Function_Det_BQ f_Det_BQ ;
CheckFunction ( )
{
Init ( ) ;
@ -1761,9 +1820,9 @@ struct CheckFunction
f_Image_Align . Init ( ) ;
f_Dectect_LackPol . Init ( ) ;
f_SecondDetect . Init ( ) ;
f_AD_Check . Init ( ) ;
f_POL_Check . Init ( ) ;
f_dege_Det . Init ( ) ;
f_Det_BQ . Init ( ) ;
}
void copy ( CheckFunction tem )
{
@ -1781,9 +1840,9 @@ struct CheckFunction
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 ) ;
this - > f_Det_BQ . copy ( tem . f_Det_BQ ) ;
}
void print ( std : : string str )
{
@ -1801,9 +1860,9 @@ struct CheckFunction
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 " ) ;
f_Det_BQ . print ( " f_Det_BQ " ) ;
}
std : : string GetInfo ( std : : string str )
{
@ -1822,9 +1881,9 @@ struct CheckFunction
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 " ) ;
str123 + = f_Det_BQ . GetInfo ( " f_Det_BQ " ) ;
return str123 ;
}
} ;
@ -2209,6 +2268,9 @@ struct Base_Function_AD_Check
AD_Analysisy_Dis analysis_dis ; // 距离分析
AD_Analysisy_S analysis_s ; // s 标准分析
AD_Analysisy_IOU analysis_iou ; // IOU 分析
AD_Analysisy_Bind analysis_bind ; // 绑定分析
AD_Analysisy_SF analysis_sf ; // 同画面参数分析
Base_Function_AD_Check ( )
{
@ -2224,6 +2286,8 @@ struct Base_Function_AD_Check
analysis_dis . Init ( ) ;
analysis_s . Init ( ) ;
analysis_iou . Init ( ) ;
analysis_bind . Init ( ) ;
analysis_sf . Init ( ) ;
}
void copy ( Base_Function_AD_Check tem )
@ -2236,17 +2300,21 @@ struct Base_Function_AD_Check
this - > analysis_dis . copy ( tem . analysis_dis ) ;
this - > analysis_s . copy ( tem . analysis_s ) ;
this - > analysis_iou . copy ( tem . analysis_iou ) ;
this - > analysis_bind . copy ( tem . analysis_bind ) ;
this - > analysis_sf . copy ( tem . analysis_sf ) ;
}
void print ( std : : string str )
{
printf ( " %s>>bOpen %d %s %s %s %s %s %s \n " , str . c_str ( ) ,
printf ( " %s>>bOpen %d %s %s %s %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 ( ) ,
analysis_iou . GetInfo ( " analysis_iou " ) . c_str ( ) ) ;
analysis_iou . GetInfo ( " analysis_iou " ) . c_str ( ) ,
analysis_bind . GetInfo ( " analysis_bind " ) . c_str ( ) ,
analysis_sf . GetInfo ( " analysis_sf " ) . c_str ( ) ) ;
}
std : : string GetInfo ( std : : string str )
{
@ -2260,45 +2328,13 @@ struct Base_Function_AD_Check
str123 + = analysis_dis . GetInfo ( " analysis_dis " ) ;
str123 + = analysis_s . GetInfo ( " analysis_s " ) ;
str123 + = analysis_iou . GetInfo ( " analysis_iou " ) ;
str123 + = analysis_bind . GetInfo ( " analysis_time " ) ;
str123 + = analysis_sf . GetInfo ( " analysis_sf " ) ;
return str123 ;
}
} ;
struct Base_Function_Det_BQ
{
int BQ_expand ;
bool bBQ_AI_Det ; // 是否启用标签独立AI检测, 汇入主流程分类
Base_Function_Det_BQ ( )
{
Init ( ) ;
}
void Init ( )
{
BQ_expand = 0 ;
bBQ_AI_Det = false ;
}
void copy ( Base_Function_Det_BQ tem )
{
this - > BQ_expand = tem . BQ_expand ;
this - > bBQ_AI_Det = tem . bBQ_AI_Det ;
}
void print ( std : : string str )
{
printf ( " %d BQ_expand %d bBQ_AI_Det %d \n " , str . c_str ( ) ,
BQ_expand , bBQ_AI_Det ) ;
}
std : : string GetInfo ( std : : string str )
{
char buffer [ 256 ] ;
sprintf ( buffer , " %d BQ_expand %d bBQ_AI_Det %d \n " , str . c_str ( ) ,
BQ_expand , bBQ_AI_Det ) ;
std : : string str123 = buffer ;
return str123 ;
}
} ;
// 基础检测功能
struct BaseCheckFunction
{
@ -2308,7 +2344,6 @@ struct BaseCheckFunction
Base_Function_BigNG bigNG ;
Base_Function_EdgeChannel edgeChannel ;
Base_Function_AD_Check ad_check ;
Base_Function_Det_BQ Det_BQ ;
BaseCheckFunction ( )
{
Init ( ) ;
@ -2321,7 +2356,6 @@ struct BaseCheckFunction
bigNG . Init ( ) ;
edgeChannel . Init ( ) ;
ad_check . Init ( ) ;
Det_BQ . Init ( ) ;
}
void copy ( BaseCheckFunction tem )
{
@ -2331,7 +2365,6 @@ struct BaseCheckFunction
this - > bigNG . copy ( tem . bigNG ) ;
this - > edgeChannel . copy ( tem . edgeChannel ) ;
this - > ad_check . copy ( tem . ad_check ) ;
this - > Det_BQ . copy ( tem . Det_BQ ) ;
}
void print ( std : : string str )
{
@ -2342,7 +2375,6 @@ struct BaseCheckFunction
bigNG . print ( " bigNG " ) ;
edgeChannel . print ( " edgeChannel " ) ;
ad_check . print ( " ad_check " ) ;
Det_BQ . print ( " Det_BQ " ) ;
}
std : : string GetInfo ( std : : string str )
{
@ -2353,7 +2385,6 @@ struct BaseCheckFunction
str123 + = bigNG . GetInfo ( " bigNG " ) ;
str123 + = edgeChannel . GetInfo ( " edgeChannel " ) ;
str123 + = ad_check . GetInfo ( " ad_check " ) ;
str123 + = Det_BQ . GetInfo ( " Det_BQ " ) ;
// str123 += "\n";
return str123 ;
}