fix 分类输入图片resize(v1.2.5)

dev_heyuan
liusiyang 1 month ago
parent a9f6d659bd
commit 49390e31bb

@ -170,7 +170,7 @@ int ImgCheckAnalysisy::GetStatus()
std::string ImgCheckAnalysisy::GetVersion() std::string ImgCheckAnalysisy::GetVersion()
{ {
return std::string("BOE_1.2.4_" + std::string(__DATE__) + "_" + std::string(__TIME__)); return std::string("BOE_1.2.5_" + std::string(__DATE__) + "_" + std::string(__TIME__));
} }
std::string ImgCheckAnalysisy::GetErrorInfo() std::string ImgCheckAnalysisy::GetErrorInfo()
@ -3747,11 +3747,13 @@ int ImgCheckAnalysisy::AI_Classify_New(const cv::Mat &src_Img, cv::Rect qx_roi,
if (3 != AI_detImage.channels()) if (3 != AI_detImage.channels())
{ {
cv::cvtColor(AI_detImage(task->roi), task->input, cv::COLOR_GRAY2BGR); cv::Mat temsizeimg;
cv::resize(AI_detImage(task->roi), temsizeimg, sz);
cv::cvtColor(temsizeimg, task->input, cv::COLOR_GRAY2BGR);
} }
else else
{ {
task->input = AI_detImage(task->roi).clone(); cv::resize(AI_detImage(task->roi), task->input, sz);
} }
task->engine = pAIDet; task->engine = pAIDet;
@ -3765,6 +3767,12 @@ int ImgCheckAnalysisy::AI_Classify_New(const cv::Mat &src_Img, cv::Rect qx_roi,
if (runner->PopResult(result)) if (runner->PopResult(result))
{ {
// if (true)
// {
// printf("result->cls_score %f\n",result->cls_score);
// std::string classpath = std::to_string(result->cls_label) + "_" + std::to_string(result->cls_score) + ".png";
// cv::imwrite(classpath, result->input);
// }
int cls_num = result->cls_label; int cls_num = result->cls_label;
if (cls_num >= 0 && cls_num < maxcls) if (cls_num >= 0 && cls_num < maxcls)
{ {
@ -3893,6 +3901,7 @@ int ImgCheckAnalysisy::AI_Classify_New(const cv::Mat &src_Img, cv::Rect qx_roi,
if (true) if (true)
{ {
// 长宽比 // 长宽比
bool bIsLine = false;
float flenr = 1; float flenr = 1;
int len = 0; int len = 0;
int widt = 0; int widt = 0;
@ -3919,6 +3928,7 @@ int ImgCheckAnalysisy::AI_Classify_New(const cv::Mat &src_Img, cv::Rect qx_roi,
// getchar(); // getchar();
cls_num = AI_CLass_QX_NAME_line; cls_num = AI_CLass_QX_NAME_line;
strclassName = "line"; strclassName = "line";
bIsLine = true;
} }
// 长宽比过小,判断成 // 长宽比过小,判断成
else if (flenr > 4 && else if (flenr > 4 &&
@ -3931,7 +3941,9 @@ int ImgCheckAnalysisy::AI_Classify_New(const cv::Mat &src_Img, cv::Rect qx_roi,
// getchar(); // getchar();
cls_num = AI_CLass_QX_NAME_line; cls_num = AI_CLass_QX_NAME_line;
strclassName = "line"; strclassName = "line";
bIsLine = true;
} }
m_pdetlog->AddCheckstr(PrintLevel_3, DET_LOG_LEVEL_3, "AI_Classify_line", "bIsLine %d, flenr %f len %d,widt %d,fjustarea %f", bIsLine, flenr,len,widt,fjustarea);
} }
} }

Loading…
Cancel
Save