|
|
|
@ -1773,6 +1773,10 @@ int ImgCheckAnalysisy::GetBLob_YX()
|
|
|
|
cv::findContours(erodedImage, contours, RETR_EXTERNAL, CHAIN_APPROX_SIMPLE);
|
|
|
|
cv::findContours(erodedImage, contours, RETR_EXTERNAL, CHAIN_APPROX_SIMPLE);
|
|
|
|
int nresult = 0;
|
|
|
|
int nresult = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 将 mask 一次性 resize 到 detImg 尺寸,避免循环内反复 resize
|
|
|
|
|
|
|
|
cv::Mat maskImg;
|
|
|
|
|
|
|
|
cv::resize(erodedImage, maskImg, cv::Size(m_pImageAllResult->detImg.cols, m_pImageAllResult->detImg.rows), 0, 0, cv::INTER_AREA);
|
|
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < contours.size(); ++i)
|
|
|
|
for (size_t i = 0; i < contours.size(); ++i)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
@ -1790,7 +1794,15 @@ int ImgCheckAnalysisy::GetBLob_YX()
|
|
|
|
|
|
|
|
|
|
|
|
roi.y *= fy_src;
|
|
|
|
roi.y *= fy_src;
|
|
|
|
roi.height *= fy_src;
|
|
|
|
roi.height *= fy_src;
|
|
|
|
float len = std::sqrt(roi.width * roi.width + roi.height * roi.height);
|
|
|
|
|
|
|
|
|
|
|
|
// 精确计算长度
|
|
|
|
|
|
|
|
float re_len = Cal_QXLen(maskImg(roi), config_qx_type, fx_src, fy_src);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cv::Scalar result = calc_blob_info_withstats(m_pImageAllResult->detImg, maskImg, roi);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double min_val, max_val;
|
|
|
|
|
|
|
|
cv::Point min_loc, max_loc;
|
|
|
|
|
|
|
|
cv::minMaxLoc(m_pImageAllResult->detImg(roi), &min_val, &max_val, &min_loc, &max_loc);
|
|
|
|
|
|
|
|
|
|
|
|
if (true)
|
|
|
|
if (true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -1800,12 +1812,12 @@ int ImgCheckAnalysisy::GetBLob_YX()
|
|
|
|
temerror.area = area;
|
|
|
|
temerror.area = area;
|
|
|
|
temerror.JudgArea = judgeArea;
|
|
|
|
temerror.JudgArea = judgeArea;
|
|
|
|
temerror.JudgArea_second = judgeArea;
|
|
|
|
temerror.JudgArea_second = judgeArea;
|
|
|
|
temerror.energy = area * fx_src * fy_src;
|
|
|
|
temerror.energy = result[1];
|
|
|
|
temerror.flen = len;
|
|
|
|
temerror.flen = re_len;
|
|
|
|
temerror.nconfig_qx_type = config_qx_type;
|
|
|
|
temerror.nconfig_qx_type = config_qx_type;
|
|
|
|
temerror.qx_name = qx_name;
|
|
|
|
temerror.qx_name = qx_name;
|
|
|
|
temerror.maxValue = 0;
|
|
|
|
temerror.maxValue = max_val;
|
|
|
|
temerror.grayDis = 0;
|
|
|
|
temerror.grayDis = result[2];
|
|
|
|
temerror.density = 0;
|
|
|
|
temerror.density = 0;
|
|
|
|
temerror.fUpIou = 0;
|
|
|
|
temerror.fUpIou = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|