|
|
|
@ -170,7 +170,7 @@ int ImgCheckAnalysisy::GetStatus()
|
|
|
|
|
|
|
|
|
|
|
|
std::string ImgCheckAnalysisy::GetVersion()
|
|
|
|
std::string ImgCheckAnalysisy::GetVersion()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return std::string("BOE_1.2.0");
|
|
|
|
return std::string("BOE_1.2.1_" + std::string(__DATE__) + "_" + std::string(__TIME__));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string ImgCheckAnalysisy::GetErrorInfo()
|
|
|
|
std::string ImgCheckAnalysisy::GetErrorInfo()
|
|
|
|
@ -332,7 +332,7 @@ cv::Scalar ImgCheckAnalysisy::calc_blob_info_withstats(cv::Mat &img, const cv::M
|
|
|
|
|
|
|
|
|
|
|
|
// 计算 hj(差异图像大于0的像素均值)
|
|
|
|
// 计算 hj(差异图像大于0的像素均值)
|
|
|
|
// double hj = std::abs(fbk - fdet);
|
|
|
|
// double hj = std::abs(fbk - fdet);
|
|
|
|
double hj = CheckUtil::CalHj(cimg, cmask, mean_bk.val[0]);
|
|
|
|
double hj = CheckUtil::CalHjWeighted(cimg, cmask, fbk, 2.0f);
|
|
|
|
|
|
|
|
|
|
|
|
int worb = 0;
|
|
|
|
int worb = 0;
|
|
|
|
if (fdet >= fbk)
|
|
|
|
if (fdet >= fbk)
|
|
|
|
@ -381,7 +381,7 @@ double ImgCheckAnalysisy::CalBlobHJ(cv::Mat &img, const cv::Mat &mask, cv::Rect
|
|
|
|
|
|
|
|
|
|
|
|
// 计算 hj(差异图像大于0的像素均值)
|
|
|
|
// 计算 hj(差异图像大于0的像素均值)
|
|
|
|
// double hj = std::abs(fbk - fdet);
|
|
|
|
// double hj = std::abs(fbk - fdet);
|
|
|
|
double hj = CheckUtil::CalHj(cimg, cmask, fbk);
|
|
|
|
double hj = CheckUtil::CalHjWeighted(cimg, cmask, fbk, 2.0f);
|
|
|
|
static int kkk = 0;
|
|
|
|
static int kkk = 0;
|
|
|
|
|
|
|
|
|
|
|
|
unsigned char *pErrordata = (unsigned char *)cimg.data;
|
|
|
|
unsigned char *pErrordata = (unsigned char *)cimg.data;
|
|
|
|
@ -589,6 +589,7 @@ int ImgCheckAnalysisy::SetNewConfig()
|
|
|
|
m_pRegionAnalysisyParam = &m_pCommonAnalysisyConfig->regionConfigArr.at(0);
|
|
|
|
m_pRegionAnalysisyParam = &m_pCommonAnalysisyConfig->regionConfigArr.at(0);
|
|
|
|
GetParamidx();
|
|
|
|
GetParamidx();
|
|
|
|
UpdateImgageScale();
|
|
|
|
UpdateImgageScale();
|
|
|
|
|
|
|
|
UPdateLDConfig();
|
|
|
|
if (true)
|
|
|
|
if (true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("SetNewConfig m_nConfigIdx %d m_CheckConfig.strSkuName %s \n", m_nConfigIdx, m_AnalysisyConfig.strSkuName.c_str());
|
|
|
|
printf("SetNewConfig m_nConfigIdx %d m_CheckConfig.strSkuName %s \n", m_nConfigIdx, m_AnalysisyConfig.strSkuName.c_str());
|
|
|
|
@ -2484,6 +2485,11 @@ int ImgCheckAnalysisy::AI_Detect_QX()
|
|
|
|
m_pdetlog->AddCheckstr(PrintLevel_2, DET_LOG_LEVEL_3, strBaseLog, "=======model use Chess");
|
|
|
|
m_pdetlog->AddCheckstr(PrintLevel_2, DET_LOG_LEVEL_3, strBaseLog, "=======model use Chess");
|
|
|
|
pAI_Model = AI_Factory->AI_defect_Chess;
|
|
|
|
pAI_Model = AI_Factory->AI_defect_Chess;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (m_pFuntion->function.f_BaseDet.strAIMode == "RGB-HGRAY")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_pdetlog->AddCheckstr(PrintLevel_2, DET_LOG_LEVEL_3, strBaseLog, "=======model use RE_RGBHGRAY");
|
|
|
|
|
|
|
|
pAI_Model = AI_Factory->AI_defect_RE_RGBHGRAY;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_pdetlog->AddCheckstr(PrintLevel_2, DET_LOG_LEVEL_3, strBaseLog, "=======model use base");
|
|
|
|
m_pdetlog->AddCheckstr(PrintLevel_2, DET_LOG_LEVEL_3, strBaseLog, "=======model use base");
|
|
|
|
@ -3358,17 +3364,17 @@ int ImgCheckAnalysisy::BLobToDetResult()
|
|
|
|
config_qx_type == CONFIG_QX_NAME_Other ||
|
|
|
|
config_qx_type == CONFIG_QX_NAME_Other ||
|
|
|
|
config_qx_type == CONFIG_QX_NAME_LD)
|
|
|
|
config_qx_type == CONFIG_QX_NAME_LD)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string qx_name = CONFIG_QX_NAME_Names[config_qx_type];
|
|
|
|
qx_name = CONFIG_QX_NAME_Names[config_qx_type];
|
|
|
|
// m_TemCheck.AddCheckstr(PrintLevel_3, DET_LOG_LEVEL_3, "LD", "stsrt config_qx_type %s ", qx_name.c_str());
|
|
|
|
// m_TemCheck.AddCheckstr(PrintLevel_3, DET_LOG_LEVEL_3, "LD", "stsrt config_qx_type %s ", qx_name.c_str());
|
|
|
|
int dbresult = LDJudge(config_qx_type, roi, JudgArea, blobs.blobTab[i].maxValue, blobs.blobTab[i].grayDis, pQxlog);
|
|
|
|
int dbresult = LDJudge(config_qx_type, roi, JudgArea, blobs.blobTab[i].maxValue, blobs.blobTab[i].grayDis, pQxlog);
|
|
|
|
int detre = 1;
|
|
|
|
//int detre = 1;
|
|
|
|
// 表示L0 和 DP 都有的 亮的
|
|
|
|
// 表示L0 和 DP 都有的 亮的
|
|
|
|
if (dbresult == 1)
|
|
|
|
if (dbresult == 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
config_qx_type = CONFIG_QX_NAME_LD;
|
|
|
|
config_qx_type = CONFIG_QX_NAME_LD;
|
|
|
|
qx_name = CONFIG_QX_NAME_Names[config_qx_type];
|
|
|
|
qx_name = CONFIG_QX_NAME_Names[config_qx_type];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pQxlog->AddCheckstr(PrintLevel_2, DET_LOG_LEVEL_3, " LD Judge ", "%s qx %s ", Re_TO_STR_False(detre), qx_name.c_str());
|
|
|
|
pQxlog->AddCheckstr(PrintLevel_2, DET_LOG_LEVEL_3, " LD Judge ", "%s qx %s ", Re_TO_STR_Pass_1(dbresult), qx_name.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 如果是chess 画面,缺陷类型直接是chess异常。
|
|
|
|
// 如果是chess 画面,缺陷类型直接是chess异常。
|
|
|
|
if (m_pFuntion->function.f_AIQX.bAllToChess)
|
|
|
|
if (m_pFuntion->function.f_AIQX.bAllToChess)
|
|
|
|
@ -3452,7 +3458,7 @@ int ImgCheckAnalysisy::BLobToDetResult()
|
|
|
|
bool ban = JudgeQXAnalysis(config_qx_type, pQxlog);
|
|
|
|
bool ban = JudgeQXAnalysis(config_qx_type, pQxlog);
|
|
|
|
if (!ban)
|
|
|
|
if (!ban)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string qx_name = CONFIG_QX_NAME_Names[config_qx_type];
|
|
|
|
qx_name = CONFIG_QX_NAME_Names[config_qx_type];
|
|
|
|
pQxlog->AddCheckstr(PrintLevel_2, DET_LOG_LEVEL_3, "Judge QX", "qx function close, config_qx_type %s Not Det",
|
|
|
|
pQxlog->AddCheckstr(PrintLevel_2, DET_LOG_LEVEL_3, "Judge QX", "qx function close, config_qx_type %s Not Det",
|
|
|
|
qx_name.c_str());
|
|
|
|
qx_name.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
@ -3469,7 +3475,7 @@ int ImgCheckAnalysisy::BLobToDetResult()
|
|
|
|
isMarksheildQX = Judge_MarkLine_QX(config_qx_type, roi, pQxlog);
|
|
|
|
isMarksheildQX = Judge_MarkLine_QX(config_qx_type, roi, pQxlog);
|
|
|
|
if (isMarksheildQX)
|
|
|
|
if (isMarksheildQX)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string qx_name = CONFIG_QX_NAME_Names[config_qx_type];
|
|
|
|
qx_name = CONFIG_QX_NAME_Names[config_qx_type];
|
|
|
|
pQxlog->AddCheckstr(PrintLevel_2, DET_LOG_LEVEL_3, "MarkLine_QX", "MarkLine_QX close, config_qx_type %s Not Det",
|
|
|
|
pQxlog->AddCheckstr(PrintLevel_2, DET_LOG_LEVEL_3, "MarkLine_QX", "MarkLine_QX close, config_qx_type %s Not Det",
|
|
|
|
qx_name.c_str());
|
|
|
|
qx_name.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|