@ -63,7 +63,7 @@ int AI_Edge_Algin::Detect(const cv::Mat &img, DetConfig *pDetConfig, std::shared
re = Det_big ( img , rois , pCheckResult_Aling - > edge_RoiList , Big_roi , big_mask ) ;
re = Det_big ( img , rois , pCheckResult_Aling - > edge_RoiList , Big_roi , big_mask ) ;
if ( re ! = 0 )
if ( re ! = 0 )
{
{
printf ( " AICheck_Edge_Big----error %d \n " , re ) ;
// printf("AICheck_Edge_Big----error %d \n", re);
if ( m_pDetConfig - > IsSaveProcessImg ( ) )
if ( m_pDetConfig - > IsSaveProcessImg ( ) )
{
{
cv : : imwrite ( str_error , img ) ;
cv : : imwrite ( str_error , img ) ;
@ -84,7 +84,7 @@ int AI_Edge_Algin::Detect(const cv::Mat &img, DetConfig *pDetConfig, std::shared
re = Dtet_small ( img , rois , Src_Mask ) ;
re = Dtet_small ( img , rois , Src_Mask ) ;
if ( re ! = 0 )
if ( re ! = 0 )
{
{
printf ( " AICheck_Edge_Small----error %d \n " , re ) ;
// printf("AICheck_Edge_Small----error %d \n", re);
if ( m_pDetConfig - > IsSaveProcessImg ( ) )
if ( m_pDetConfig - > IsSaveProcessImg ( ) )
{
{
cv : : imwrite ( str_error , img ) ;
cv : : imwrite ( str_error , img ) ;
@ -151,7 +151,7 @@ int AI_Edge_Algin::Detect(const cv::Mat &img, DetConfig *pDetConfig, std::shared
{
{
double widthDiff = std : : abs ( result_roi . width - m_pDetConfig - > drawRoi . width ) * 1.0f / std : : min ( result_roi . width , m_pDetConfig - > drawRoi . width ) ;
double widthDiff = std : : abs ( result_roi . width - m_pDetConfig - > drawRoi . width ) * 1.0f / std : : min ( result_roi . width , m_pDetConfig - > drawRoi . width ) ;
double heightDiff = std : : abs ( result_roi . height - m_pDetConfig - > drawRoi . height ) * 1.0f / std : : min ( result_roi . height , m_pDetConfig - > drawRoi . height ) ;
double heightDiff = std : : abs ( result_roi . height - m_pDetConfig - > drawRoi . height ) * 1.0f / std : : min ( result_roi . height , m_pDetConfig - > drawRoi . height ) ;
printf ( " draw roi %s det %s widthDiff %f heightDiff %f \n " , CheckUtil : : GetRectString ( m_pDetConfig - > drawRoi ) . c_str ( ) , CheckUtil : : GetRectString ( result_roi ) . c_str ( ) , widthDiff , heightDiff ) ;
//printf("draw roi %s det %s widthDiff %f heightDiff %f\n", CheckUtil::GetRectString(m_pDetConfig->drawRoi).c_str(), CheckUtil::GetRectString(result_roi).c_str(), widthDiff, heightDiff);
// 如果差异超过10%,抛出异常
// 如果差异超过10%,抛出异常
if ( widthDiff > 0.10 )
if ( widthDiff > 0.10 )
{
{
@ -178,7 +178,7 @@ int AI_Edge_Algin::Detect(const cv::Mat &img, DetConfig *pDetConfig, std::shared
{
{
int diff = std : : abs ( va_big - va_small ) ; // 面积的差异值。
int diff = std : : abs ( va_big - va_small ) ; // 面积的差异值。
float fs = diff * 1.0f / va_big ;
float fs = diff * 1.0f / va_big ;
printf ( " va_big %d va_small %d dff %d diffscale %f \n " , va_big , va_small , diff , fs ) ;
// printf("va_big %d va_small %d dff %d diffscale %f \n", va_big, va_small, diff, fs);
if ( fs > 0.1 )
if ( fs > 0.1 )
{
{
// if (true)
// if (true)
@ -211,7 +211,7 @@ int AI_Edge_Algin::Detect(const cv::Mat &img, DetConfig *pDetConfig, std::shared
{
{
int diff = std : : abs ( va_draw - va_small ) ; // 面积的差异值。
int diff = std : : abs ( va_draw - va_small ) ; // 面积的差异值。
float fs = diff * 1.0f / va_draw ;
float fs = diff * 1.0f / va_draw ;
printf ( " va_draw %d va_small %d dff %d diffscale %f \n " , va_draw , va_small , diff , fs ) ;
// printf("va_draw %d va_small %d dff %d diffscale %f \n", va_draw, va_small, diff, fs);
if ( fs > 0.1 )
if ( fs > 0.1 )
{
{
return 56 ;
return 56 ;
@ -388,13 +388,13 @@ int AI_Edge_Algin::InitModel_ALL()
int re = InitModel_Big ( ) ;
int re = InitModel_Big ( ) ;
if ( re ! = 0 )
if ( re ! = 0 )
{
{
printf ( " AI_Edge_Algin InitModel_Big Error \n " ) ;
// printf("AI_Edge_Algin InitModel_Big Error \n");
return re ;
return re ;
}
}
re = InitModel_Small ( ) ;
re = InitModel_Small ( ) ;
if ( re ! = 0 )
if ( re ! = 0 )
{
{
printf ( " AI_Edge_Algin InitModel_Small Error \n " ) ;
// printf("AI_Edge_Algin InitModel_Small Error \n");
return re ;
return re ;
}
}
@ -431,7 +431,7 @@ int AI_Edge_Algin::Det_big(const cv::Mat &img, vector<Rect> &smallRoiList, std::
big_mask = mask ;
big_mask = mask ;
if ( re ! = 0 )
if ( re ! = 0 )
{
{
printf ( " AICheck_Edge_Big----error \n " ) ;
// printf("AICheck_Edge_Big----error \n");
int re123 = 100 + re ;
int re123 = 100 + re ;
return re123 ;
return re123 ;
}
}
@ -481,7 +481,7 @@ int AI_Edge_Algin::Det_big(const cv::Mat &img, vector<Rect> &smallRoiList, std::
{
{
double widthDiff = std : : abs ( bigRoi . width - m_pDetConfig - > drawRoi . width ) * 1.0f / std : : min ( bigRoi . width , m_pDetConfig - > drawRoi . width ) ;
double widthDiff = std : : abs ( bigRoi . width - m_pDetConfig - > drawRoi . width ) * 1.0f / std : : min ( bigRoi . width , m_pDetConfig - > drawRoi . width ) ;
double heightDiff = std : : abs ( bigRoi . height - m_pDetConfig - > drawRoi . height ) * 1.0f / std : : min ( bigRoi . height , m_pDetConfig - > drawRoi . height ) ;
double heightDiff = std : : abs ( bigRoi . height - m_pDetConfig - > drawRoi . height ) * 1.0f / std : : min ( bigRoi . height , m_pDetConfig - > drawRoi . height ) ;
printf ( " draw roi %s bigRoi %s widthDiff %f heightDiff %f \n " , CheckUtil : : GetRectString ( m_pDetConfig - > drawRoi ) . c_str ( ) , CheckUtil : : GetRectString ( bigRoi ) . c_str ( ) , widthDiff , heightDiff ) ;
// printf(" draw roi %s bigRoi %s widthDiff %f heightDiff %f\n", CheckUtil::GetRectString(m_pDetConfig->drawRoi).c_str(), CheckUtil::GetRectString(bigRoi).c_str(), widthDiff, heightDiff);
// 如果差异超过10%,抛出异常
// 如果差异超过10%,抛出异常
if ( widthDiff > 0.10 )
if ( widthDiff > 0.10 )
{
{
@ -753,7 +753,7 @@ int AI_Edge_Algin::Dtet_small(const cv::Mat &img, vector<Rect> &smallRoiList, cv
if ( ! CheckUtil : : RoiInImg ( task - > roi , img ) )
if ( ! CheckUtil : : RoiInImg ( task - > roi , img ) )
{
{
CheckUtil : : printROI ( task - > roi , " small roi 1 " ) ;
CheckUtil : : printROI ( task - > roi , " small roi 1 " ) ;
printf ( " img %d %d \n " , img . cols , img . rows ) ;
// printf("img %d %d \n", img.cols, img.rows);
}
}
task - > input = img ( smallRoiList . at ( submitted ) ) . clone ( ) ;
task - > input = img ( smallRoiList . at ( submitted ) ) . clone ( ) ;
@ -919,8 +919,8 @@ int Image_Feature_Algin::Detect(DetConfig *pDetConfig, Align_Result *pResult, st
int m_y = pDetConfig - > feature_Roi . y * fy - pDetConfig - > Search_Roi . y ;
int m_y = pDetConfig - > feature_Roi . y * fy - pDetConfig - > Search_Roi . y ;
pResult - > offt_x = bestMatch . x - m_x ;
pResult - > offt_x = bestMatch . x - m_x ;
pResult - > offt_y = bestMatch . y - m_y ;
pResult - > offt_y = bestMatch . y - m_y ;
printf ( " m_x %d bestMatch.x %d offt_x %d \n " , m_x , bestMatch . x , pResult - > offt_x ) ;
// printf("m_x %d bestMatch.x %d offt_x %d\n", m_x, bestMatch.x, pResult->offt_x);
printf ( " m_y %d bestMatch.y %d offt_y %d \n " , m_y , bestMatch . y , pResult - > offt_y ) ;
// printf("m_y %d bestMatch.y %d offt_y %d\n", m_y, bestMatch.y, pResult->offt_y);
pResult - > bDet = true ;
pResult - > bDet = true ;