优化ZYWL检测结果,增加芯片尺寸参数判断

master
xiewenji 2 months ago
parent 09cef2e566
commit 9659428e7f

@ -83,8 +83,8 @@ int main(int argc, char *argv[])
// ReadSystemConfig("../data/Top1_Det/System_Config.json", psystem_param);
// CAMERA_POSITION cam_position = CAMERA_TOP_1;//相机位置
// ReadSystemConfig("../data/Top2_Det/System_Config.json", psystem_param);
// CAMERA_POSITION cam_position = CAMERA_TOP_2;//相机位置
ReadSystemConfig("../data/Top2_Det/System_Config.json", psystem_param);
CAMERA_POSITION cam_position = CAMERA_TOP_2;//相机位置
// ReadSystemConfig("../data/Side1_Det/System_Config.json", psystem_param);
// CAMERA_POSITION cam_position = CAMERA_SIDE_1;//相机位置
@ -96,9 +96,9 @@ int main(int argc, char *argv[])
// CAMERA_POSITION cam_position = CAMERA_DOWN_1;//相机位置
//测旋转
ReadSystemConfig("../data/Down_Det/System_Config.json", psystem_param);
CAMERA_POSITION cam_position = CAMERA_DOWN_1;//相机位置
detect_type = DETECT_TYPE_ANGLE;
// ReadSystemConfig("../data/Down_Det/System_Config.json", psystem_param);
// CAMERA_POSITION cam_position = CAMERA_DOWN_1;//相机位置
// detect_type = DETECT_TYPE_ANGLE;
std::shared_ptr<ImgCheckBase> pImgCount = ImgCheckBase::GetInstance();
printf("%s %s \n", pImgCount->GetVersion().c_str(), pImgCount->GetErrorInfo().c_str());

@ -65,13 +65,17 @@ int ALL_Detect::CheckImg(std::shared_ptr<shareImage> p, std::shared_ptr<CheckRes
// printf("%d DetImgInfo_shareP count %ld \n", m_RunConfig.nThreadIdx, DetImgInfo_shareP.use_count());
if (m_cam_param.cam_position != p->cam_position)
{
std::cout << "ERROR: ALL_Detect cam_position not match, expect: " << m_cam_param.cam_position
<< ", but got: " << p->cam_position << std::endl;
return -1;
}
if (p->detect_type == DETECT_TYPE_ANGLE)
{
if (p->cam_position != CAMERA_DOWN_1)
if (p->cam_position != CAMERA_DOWN_1) {
std::cout << "ERROR: Down_Angle_Detect only support CAMERA_DOWN_1" << std::endl;
return -2;
}
this->down_angle_detect.CheckImg(p, pResult);
}
else

@ -126,7 +126,10 @@ struct Base_Function_DetConfig
DetRotateType rotate;
cv::Rect LabelPolygonBoundingRect; // 标记的芯片多边形最大外接矩形 1107-add
std::vector<cv::Point> pointArry; // 最小外接矩形
int chip_width_mm; // 芯片宽度 mm 1107-add
int chip_height_mm; // 芯片高度 mm 1107-add
int chip_width_offset_mm; // 芯片宽度偏差 mm
int chip_height_offset_mm; // 芯片高度偏差 mm 1107-add
Base_Function_DetConfig()
{
Init();
@ -139,6 +142,8 @@ struct Base_Function_DetConfig
LabelPolygonBoundingRect = cv::Rect(0, 0, 0, 0); // 1107-add
pointArry.clear(); // 1107-add
pointArry.shrink_to_fit(); // 1107-add
chip_width_mm = 0; // 1107-add
chip_height_mm = 0; // 1107-add
}
void copy(Base_Function_DetConfig tem)
@ -148,6 +153,8 @@ struct Base_Function_DetConfig
this->rotate = tem.rotate;
this->pointArry.assign(tem.pointArry.begin(), tem.pointArry.end()); // 1107-add
this->LabelPolygonBoundingRect = tem.LabelPolygonBoundingRect; // 1107-add
this->chip_width_mm = tem.chip_width_mm; // 1107-add
this->chip_height_mm = tem.chip_height_mm; // 1107
}
void print(std::string str)
{

@ -73,30 +73,4 @@ struct ROI2ROI_SCALE
}
};
struct BlobResult
{
int nresult;
int nYsresult;
int type;
int area_piexl;
float area_mm2;
int hj;
cv::Rect roi;
BlobResult()
{
Init();
}
void Init()
{
nresult = 0;
nYsresult = 0;
type = 0;
area_piexl = 0;
area_mm2 = 0;
hj = 0;
roi = cv::Rect(0, 0, 0, 0);
}
};
#endif

@ -15,10 +15,10 @@
#define _ImgCheckConfig_HPP_
#include <string>
#include <opencv2/opencv.hpp>
#include "DetCommonDefine.hpp"
#define RESULT_VERSION 1
#define RESULT_WIDTH 800
#define RESULT_HEIGHT 600
struct VERSION_INFO
{
@ -62,6 +62,32 @@ struct Cam_Param
}
};
struct BlobResult
{
int nresult;
int nYsresult;
int type;
int area_piexl;
float area_mm2;
int hj;
cv::Rect roi;
BlobResult()
{
Init();
}
void Init()
{
nresult = 0;
nYsresult = 0;
type = 0;
area_piexl = 0;
area_mm2 = 0;
hj = 0;
roi = cv::Rect(0, 0, 0, 0);
}
};
// 一个检测项基本信息,包括图片序号,图片、开始时间
struct shareImage
{

@ -451,28 +451,13 @@ int CheckBaseParamJson::GetFunction(Json::Value value)
}
}
// //测试
// auto test_param = value_f["form"]["Crop_Config"]["DD"].asInt(); // 1020-add
// bool dd_disabled = value_f["form"]["Crop_Config"]["DD_disabled"].asBool(); // 1020-add
// auto LablCircleradius = value_f["form"]["Test_Data"]["CenterP"]["radius"].asInt();
// auto LablCircleCoordinate = value_f["form"]["Test_Data"]["CenterP"]["path"];
// cv::Point CircleP = cv::Point(0, 0);
// if (LablCircleCoordinate.isArray())
// {
// CircleP.x = LablCircleCoordinate[0][0].asInt();
// CircleP.y = LablCircleCoordinate[0][1].asInt();
// }
// std::vector<cv::Point> lablPoints;
// auto test_area = value_f["form"]["Test_Data"]["test_area"];
// if (test_area.isArray())
// {
// for (auto it: test_area) {
// lablPoints.emplace_back(cv::Point(it[0].asInt(), it[1].asInt()));
// }
// }
// 芯片尺寸
pdetConfig->chip_width_mm = value_f["form"]["Chip_Size"]["ChipWidth"].asInt(); // 1020-add
pdetConfig->chip_height_mm = value_f["form"]["Chip_Size"]["ChipHeight"].asInt(); // 1020-add
pdetConfig->chip_width_offset_mm = value_f["form"]["Chip_Size"]["ChipWOffset"].asInt(); // 1020-add
pdetConfig->chip_height_offset_mm = value_f["form"]["Chip_Size"]["ChipHOffset"].asInt(); // 1020-add
// 旋转角度
auto rotate = value_f["form"]["RotateConfig"]["Rotate"].asInt(); // 1020-add
if (rotate == 0)
{
@ -496,10 +481,10 @@ int CheckBaseParamJson::GetFunction(Json::Value value)
}
}
}
else
{
pdetConfig->Init();
}
// else
// {
// pdetConfig->Init();
// }
}
if ("ChipOffset" == strCode) // 1009-add
@ -557,10 +542,10 @@ int CheckBaseParamJson::GetFunction(Json::Value value)
pdetConfig->LabelPolygonBoundingRect = cv::boundingRect(pdetConfig->pointArry); // 获取芯片区域的标记多边形最大外接矩形
}
}
else
{
pdetConfig->Init();
}
// else
// {
// pdetConfig->Init();
// }
}
return 0;
}

@ -338,7 +338,7 @@ int Down_Angle_Detect::CheckRun()
m_LabelCenterP = LabelCenterP;
// 计算与x轴角度正负按照RotatedRect定义
float LabelAngle = rotatedRect.size.width < rotatedRect.size.height ? 90 - std::abs(rotatedRect.angle) : rotatedRect.angle;
// 按照边计算距离
// 按照边计算距离
double LabelP1P2dis = std::max(rotatedRect.size.width, rotatedRect.size.height);
// float LabelAngle = calculate_angle2(LineP1, LineP2);
@ -767,7 +767,7 @@ int Down_Angle_Detect::AI_Run(const cv::Mat &img, cv::Point s2StartP, double Lab
{
continue;
}
//二次定位
const int h = 360;
cv::Point start{MaxRoi.x, MaxRoi.y + MaxRoi.height - h / 2};
cv::Rect SecondAlignRoi{start.x, start.y, MaxRoi.width, h};

@ -1,6 +1,7 @@
#include "Down_Detect.hpp"
#include "CheckErrorCode.hpp"
#include "CheckUtil.hpp"
#include "DetCommonDefine.hpp"
using namespace cv;
using namespace std;
// 检测模型 单个小图 输入模型图片尺寸
@ -86,6 +87,8 @@ int Down_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())
{
return 1;
@ -299,13 +302,30 @@ int Down_Detect::Draw(const cv::Mat &img, cv::Mat &resultimg)
{
resultimg = img.clone();
}
// //裁剪到包括产品1600x1200
// int w = 1600;
// int h = 1200;
// cv::Point center{this->m_AlignMaxRoi.x + this->m_AlignMaxRoi.width / 2, this->m_AlignMaxRoi.y + this->m_AlignMaxRoi.height / 2};
// int x = center.x - w / 2;
// int y = center.y - h / 2;
// // 确保裁剪区域不超出图像边界
// x = std::max(0, x);
// y = std::max(0, y);
// x = std::min(x, img.cols - w);
// y = std::min(y, img.rows - h);
// // 创建裁剪区域
// cv::Rect cropRoi(x, y, w, h);
// resultimg = resultimg(cropRoi).clone();
// cv::polylines(resultimg, m_CheckBaseConfig->pointArry, true, cv::Scalar(0, 255, 0), 2);
auto regions = m_CheckBaseConfig->nodeConfigArr[0].regionConfigArr;
for (int i = 0; i < regions.size(); i++)
{
cv::polylines(resultimg, regions[i].basicInfo.pointArry, true, cv::Scalar(0, 255, 0), 2);
}
// auto regions = m_CheckBaseConfig->nodeConfigArr[0].regionConfigArr;
// for (int i = 0; i < regions.size(); i++)
// {
// cv::polylines(resultimg, regions[i].basicInfo.pointArry, true, cv::Scalar(0, 255, 0), 2);
// }
int fontFace = cv::FONT_HERSHEY_SIMPLEX; // 字体样式
double fontScale = 1; // 字体大小
@ -353,8 +373,8 @@ int Down_Detect::Draw(const cv::Mat &img, cv::Mat &resultimg)
cv::putText(resultimg, show_info, p, fontFace, 1, color, 1);
}
// 裁剪
cv::Size sz{RESULT_WIDTH, resultimg.rows};
cv::resize(resultimg, resultimg, sz);
cv::Size dstSize(RESULT_WIDTH, RESULT_HEIGHT);
cv::resize(resultimg, resultimg, dstSize);
return 0;
}
@ -467,6 +487,20 @@ int Down_Detect::ImgAlinRotate(const cv::Mat &img, cv::Mat &alignImg)
printf("Align is Error exit \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;
if (ratio == Ratio_0)
@ -661,7 +695,7 @@ int Down_Detect::DetectImg(const cv::Mat &img)
if (tem.area_mm2 > cur_check.area && tem.hj > cur_check.hj && cur_check.bEnable)
{
tem.nresult = 1;
printf("region %d NG tem.nresult : %f>%f \n", i, tem.area_mm2, m_CheckBaseConfig->qxSegParam.Area);
printf("region %d NG tem.nresult : %f>%f \n", i, tem.area_mm2, cur_check.area);
}
else
{
@ -669,11 +703,11 @@ int Down_Detect::DetectImg(const cv::Mat &img)
if (tem.area_mm2 > cur_ys.area && tem.hj > cur_ys.hj && cur_ys.bEnable)
{
tem.nYsresult = 1;
printf("region %d YS tem.nresult : %f>%f \n", i, tem.area_mm2, m_CheckBaseConfig->ysSegParam.Area);
printf("region %d YS tem.nresult : %f>%f \n", i, tem.area_mm2, cur_ys.area);
}
else
{
printf("region %d OK tem.nresult : %f < %f \n", i, tem.area_mm2, m_CheckBaseConfig->qxSegParam.Area);
printf("region %d OK tem.nresult : %f < %f \n", i, tem.area_mm2, cur_check.area);
}
}
}

@ -1,6 +1,7 @@
#include "Side_Detect.hpp"
#include "CheckErrorCode.hpp"
#include "CheckUtil.hpp"
#include "DetCommonDefine.hpp"
using namespace cv;
using namespace std;
// 检测模型 单个小图 输入模型图片尺寸
@ -87,6 +88,8 @@ int Side_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())
{
return 1;
@ -124,7 +127,7 @@ int Side_Detect::CheckRun()
t2 = CheckUtil::getcurTime();
m_CheckResult_shareP->UseTimeMS = t2 - t1;
re = Draw(AlignImg, m_CheckResult_shareP->resultImg);
re = Draw(detimg, m_CheckResult_shareP->resultImg);
if (0 != re)
{
return re;
@ -300,13 +303,30 @@ int Side_Detect::Draw(const cv::Mat &img, cv::Mat &resultimg)
{
resultimg = img.clone();
}
//裁剪到包括产品1600x1200
int w = 1600;
int h = 1200;
cv::Point center{this->m_AlignMaxRoi.x + this->m_AlignMaxRoi.width / 2, this->m_AlignMaxRoi.y + this->m_AlignMaxRoi.height / 2};
int x = center.x - w / 2;
int y = center.y - h / 2;
// 确保裁剪区域不超出图像边界
x = std::max(0, x);
y = std::max(0, y);
x = std::min(x, img.cols - w);
y = std::min(y, img.rows - h);
// 创建裁剪区域
cv::Rect cropRoi(x, y, w, h);
resultimg = resultimg(cropRoi).clone();
// cv::polylines(resultimg, m_CheckBaseConfig->pointArry, true, cv::Scalar(0, 255, 0), 2);
auto regions = m_CheckBaseConfig->nodeConfigArr[0].regionConfigArr;
for (int i = 0; i < regions.size(); i++)
{
cv::polylines(resultimg, regions[i].basicInfo.pointArry, true, cv::Scalar(0, 255, 0), 2);
}
// auto regions = m_CheckBaseConfig->nodeConfigArr[0].regionConfigArr;
// for (int i = 0; i < regions.size(); i++)
// {
// cv::polylines(resultimg, regions[i].basicInfo.pointArry, true, cv::Scalar(0, 255, 0), 2);
// }
int fontFace = cv::FONT_HERSHEY_SIMPLEX; // 字体样式
double fontScale = 1; // 字体大小
@ -332,8 +352,8 @@ int Side_Detect::Draw(const cv::Mat &img, cv::Mat &resultimg)
}
cv::Rect roi = m_resultList.at(i).roi;
cv::Point pc;
pc.x = roi.x + roi.width * 0.5;
pc.y = roi.y + roi.height * 0.5;
pc.x = roi.x + roi.width * 0.5 + (m_AlignMaxRoi.x - cropRoi.x);//转换为cropRoi中坐标
pc.y = roi.y + roi.height * 0.5 + (m_AlignMaxRoi.y - cropRoi.y);
int rw = roi.width * 0.5;
int rh = roi.height * 0.5;
int r = std::sqrt(rw * rw + rh * rh) * 1.1 + 8;
@ -349,13 +369,13 @@ int Side_Detect::Draw(const cv::Mat &img, cv::Mat &resultimg)
string show_info = buffer;
cv::Point p;
p.x = m_resultList.at(i).roi.x;
p.y = m_resultList.at(i).roi.y;
p.x = m_resultList.at(i).roi.x + (m_AlignMaxRoi.x - cropRoi.x);//转换为cropRoi中坐标
p.y = m_resultList.at(i).roi.y + (m_AlignMaxRoi.y - cropRoi.y);
cv::putText(resultimg, show_info, p, fontFace, 1, color, 1);
}
// 裁剪
cv::Size sz{RESULT_WIDTH, resultimg.rows};
cv::resize(resultimg, resultimg, sz);
cv::Size dstSize(RESULT_WIDTH, RESULT_HEIGHT);
cv::resize(resultimg, resultimg, dstSize);
return 0;
}
@ -465,9 +485,22 @@ int Side_Detect::ImgAlinRotate(const cv::Mat &img, cv::Mat &alignImg)
if (alignImg.empty())
{
printf("Align is Error exit \n");
printf("Align is empty, Error exit \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;
if (ratio == Ratio_0)
@ -662,7 +695,7 @@ int Side_Detect::DetectImg(const cv::Mat &img)
if (tem.area_mm2 > cur_check.area && tem.hj > cur_check.hj && cur_check.bEnable)
{
tem.nresult = 1;
printf("region %d NG tem.nresult : %f>%f \n", i, tem.area_mm2, m_CheckBaseConfig->qxSegParam.Area);
printf("region %d NG tem.nresult : %f>%f \n", i, tem.area_mm2, cur_check.area);
}
else
{
@ -670,11 +703,11 @@ int Side_Detect::DetectImg(const cv::Mat &img)
if (tem.area_mm2 > cur_ys.area && tem.hj > cur_ys.hj && cur_ys.bEnable)
{
tem.nYsresult = 1;
printf("region %d YS tem.nresult : %f>%f \n", i, tem.area_mm2, m_CheckBaseConfig->ysSegParam.Area);
printf("region %d YS tem.nresult : %f>%f \n", i, tem.area_mm2, cur_ys.area);
}
else
{
printf("region %d OK tem.nresult : %f < %f \n", i, tem.area_mm2, m_CheckBaseConfig->qxSegParam.Area);
printf("region %d OK tem.nresult : %f < %f \n", i, tem.area_mm2, cur_check.area);
}
}
}

@ -1,6 +1,7 @@
#include "Top_Detect.hpp"
#include "CheckErrorCode.hpp"
#include "CheckUtil.hpp"
#include "DetCommonDefine.hpp"
using namespace cv;
using namespace std;
// 检测模型 单个小图 输入模型图片尺寸
@ -85,6 +86,8 @@ 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())
{
return 1;
@ -298,13 +301,30 @@ int Top_Detect::Draw(const cv::Mat &img, cv::Mat &resultimg)
{
resultimg = img.clone();
}
// //裁剪到包括产品1600x1200
// int w = 1600;
// int h = 1200;
// cv::Point center{this->m_AlignMaxRoi.x + this->m_AlignMaxRoi.width / 2, this->m_AlignMaxRoi.y + this->m_AlignMaxRoi.height / 2};
// int x = center.x - w / 2;
// int y = center.y - h / 2;
// // 确保裁剪区域不超出图像边界
// x = std::max(0, x);
// y = std::max(0, y);
// x = std::min(x, img.cols - w);
// y = std::min(y, img.rows - h);
// // 创建裁剪区域
// cv::Rect cropRoi(x, y, w, h);
// resultimg = resultimg(cropRoi);
// cv::polylines(resultimg, m_CheckBaseConfig->pointArry, true, cv::Scalar(0, 255, 0), 2);
auto regions = m_CheckBaseConfig->nodeConfigArr[0].regionConfigArr;
for (int i = 0; i < regions.size(); i++)
{
cv::polylines(resultimg, regions[i].basicInfo.pointArry, true, cv::Scalar(0, 255, 0), 2);
}
// auto regions = m_CheckBaseConfig->nodeConfigArr[0].regionConfigArr;
// for (int i = 0; i < regions.size(); i++)
// {
// cv::polylines(resultimg, regions[i].basicInfo.pointArry, true, cv::Scalar(0, 255, 0), 2);
// }
int fontFace = cv::FONT_HERSHEY_SIMPLEX; // 字体样式
double fontScale = 1; // 字体大小
@ -352,8 +372,8 @@ int Top_Detect::Draw(const cv::Mat &img, cv::Mat &resultimg)
cv::putText(resultimg, show_info, p, fontFace, 1, color, 1);
}
// 裁剪
cv::Size sz{RESULT_WIDTH, resultimg.rows};
cv::resize(resultimg, resultimg, sz);
cv::Size dstSize(RESULT_WIDTH, RESULT_HEIGHT);
cv::resize(resultimg, resultimg, dstSize);
return 0;
}
@ -466,6 +486,20 @@ int Top_Detect::ImgAlinRotate(const cv::Mat &img, cv::Mat &alignImg)
printf("Align is Error exit \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;
if (ratio == Ratio_0)
@ -508,6 +542,7 @@ int Top_Detect::DetectImg(const cv::Mat &img)
{
showimg = AlignImg.clone();
}
printf("start --- seg \n");
cv::Mat detSrcMask = cv::Mat(AlignImg.rows, AlignImg.cols, CV_8U, cv::Scalar(0));
ROI2ROI_SCALE SegImgToSrcImg;
@ -660,7 +695,7 @@ int Top_Detect::DetectImg(const cv::Mat &img)
if (tem.area_mm2 > cur_check.area && tem.hj > cur_check.hj && cur_check.bEnable)
{
tem.nresult = 1;
printf("region %d NG tem.nresult : %f>%f \n", i, tem.area_mm2, m_CheckBaseConfig->qxSegParam.Area);
printf("region %d NG tem.nresult : %f>%f \n", i, tem.area_mm2, cur_check.area);
}
else
{
@ -668,11 +703,11 @@ int Top_Detect::DetectImg(const cv::Mat &img)
if (tem.area_mm2 > cur_ys.area && tem.hj > cur_ys.hj && cur_ys.bEnable)
{
tem.nYsresult = 1;
printf("region %d YS tem.nresult : %f>%f \n", i, tem.area_mm2, m_CheckBaseConfig->ysSegParam.Area);
printf("region %d YS tem.nresult : %f>%f \n", i, tem.area_mm2, cur_ys.area);
}
else
{
printf("region %d OK tem.nresult : %f < %f \n", i, tem.area_mm2, m_CheckBaseConfig->qxSegParam.Area);
printf("region %d OK tem.nresult : %f < %f \n", i, tem.area_mm2, cur_check.area);
}
}
}

Loading…
Cancel
Save