|
|
|
|
@ -86,7 +86,7 @@ int Top_Detect::CheckRun()
|
|
|
|
|
t1 = CheckUtil::getcurTime();
|
|
|
|
|
CheckImgInit();
|
|
|
|
|
cv::Mat detimg = DetImgInfo_shareP->img;
|
|
|
|
|
//准备结果图
|
|
|
|
|
// 准备结果图
|
|
|
|
|
cv::resize(detimg.clone(), m_CheckResult_shareP->resultImg, cv::Size(800, 600));
|
|
|
|
|
if (detimg.empty())
|
|
|
|
|
{
|
|
|
|
|
@ -114,12 +114,16 @@ int Top_Detect::CheckRun()
|
|
|
|
|
re = ImgAlinRotate(detimg, AlignImg);
|
|
|
|
|
if (0 != re)
|
|
|
|
|
{
|
|
|
|
|
// 失败NG
|
|
|
|
|
m_CheckResult_shareP->nresult = 1;
|
|
|
|
|
return re;
|
|
|
|
|
}
|
|
|
|
|
// 缺陷检测
|
|
|
|
|
re = DetectImg(AlignImg);
|
|
|
|
|
if (0 != re)
|
|
|
|
|
{
|
|
|
|
|
// 失败NG
|
|
|
|
|
m_CheckResult_shareP->nresult = 1;
|
|
|
|
|
return re;
|
|
|
|
|
}
|
|
|
|
|
t2 = CheckUtil::getcurTime();
|
|
|
|
|
@ -487,18 +491,18 @@ int Top_Detect::ImgAlinRotate(const cv::Mat &img, cv::Mat &alignImg)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//判断尺寸
|
|
|
|
|
int w = m_CheckBaseConfig->baseCheckFunction.detconfig.chip_width_mm / m_CheckBaseConfig->imageScaleParam.fScale_X;
|
|
|
|
|
int h = m_CheckBaseConfig->baseCheckFunction.detconfig.chip_height_mm / m_CheckBaseConfig->imageScaleParam.fScale_Y;
|
|
|
|
|
auto w_offset = std::abs(w - m_AlignMaxRoi.width);
|
|
|
|
|
auto h_offset = std::abs(h - m_AlignMaxRoi.height);
|
|
|
|
|
int param_w_offset = m_CheckBaseConfig->baseCheckFunction.detconfig.chip_width_offset_mm / m_CheckBaseConfig->imageScaleParam.fScale_X;
|
|
|
|
|
int param_h_offset = m_CheckBaseConfig->baseCheckFunction.detconfig.chip_height_offset_mm / m_CheckBaseConfig->imageScaleParam.fScale_Y;
|
|
|
|
|
if (w_offset > param_w_offset || h_offset > param_h_offset)
|
|
|
|
|
{
|
|
|
|
|
printf("Align error, no product\n");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
// 判断尺寸
|
|
|
|
|
int w = m_CheckBaseConfig->baseCheckFunction.detconfig.chip_width_mm / m_CheckBaseConfig->imageScaleParam.fScale_X;
|
|
|
|
|
int h = m_CheckBaseConfig->baseCheckFunction.detconfig.chip_height_mm / m_CheckBaseConfig->imageScaleParam.fScale_Y;
|
|
|
|
|
auto w_offset = std::abs(w - m_AlignMaxRoi.width);
|
|
|
|
|
auto h_offset = std::abs(h - m_AlignMaxRoi.height);
|
|
|
|
|
int param_w_offset = m_CheckBaseConfig->baseCheckFunction.detconfig.chip_width_offset_mm / m_CheckBaseConfig->imageScaleParam.fScale_X;
|
|
|
|
|
int param_h_offset = m_CheckBaseConfig->baseCheckFunction.detconfig.chip_height_offset_mm / m_CheckBaseConfig->imageScaleParam.fScale_Y;
|
|
|
|
|
if (w_offset > param_w_offset || h_offset > param_h_offset)
|
|
|
|
|
{
|
|
|
|
|
printf("Align error, no product\n");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DetRotateType ratio = m_CheckBaseConfig->baseCheckFunction.detconfig.rotate;
|
|
|
|
|
std::cout << "rotate ratio : " << ratio << std::endl;
|
|
|
|
|
|