You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
158 lines
3.3 KiB
158 lines
3.3 KiB
/*
|
|
* @Descripttion:
|
|
* @version:
|
|
* @Author: sueRimn
|
|
* @Date: 2022-03-16 17:09:11
|
|
* @LastEditors: sueRimn
|
|
* @LastEditTime: 2022-09-23 17:43:15
|
|
*/
|
|
/***********************************************/
|
|
/************ ***************/
|
|
/************金佰利检测算法参数定义**************/
|
|
/************ **************/
|
|
/**********************************************/
|
|
#ifndef _ImgCheckConfig_HPP_
|
|
#define _ImgCheckConfig_HPP_
|
|
#include <string>
|
|
#include <opencv2/opencv.hpp>
|
|
|
|
#define RESULT_VERSION 1
|
|
#define RESULT_WIDTH 800
|
|
#define RESULT_HEIGHT 600
|
|
|
|
struct VERSION_INFO
|
|
{
|
|
int ConfigVersion = 0;
|
|
int ResultVersion = RESULT_VERSION;
|
|
int InterfaceVersion = 0;
|
|
};
|
|
enum CAMERA_POSITION
|
|
{
|
|
CAMERA_TOP_1 = 0,
|
|
CAMERA_TOP_2 = 1,
|
|
CAMERA_DOWN_1 = 2,
|
|
CAMERA_SIDE_1 = 3,
|
|
CAMERA_SIDE_2 = 4,
|
|
CAMERA_POSITION_COUNT = 5,
|
|
};
|
|
enum DETECT_TYPE
|
|
{
|
|
|
|
DETECT_TYPE_QX = 0, // 缺陷检测
|
|
DETECT_TYPE_ANGLE = 1, // 角度检测
|
|
DETECT_TYPE_COUNT = 2,
|
|
};
|
|
|
|
struct Cam_Param
|
|
{
|
|
CAMERA_POSITION cam_position; // 相机位置
|
|
std::string check_param_path; // 检测参数路径
|
|
std::string AIModel_param_path; // 模型参数路劲
|
|
Cam_Param()
|
|
{
|
|
cam_position = CAMERA_TOP_1;
|
|
check_param_path = "";
|
|
AIModel_param_path = "";
|
|
}
|
|
void copy(Cam_Param tem)
|
|
{
|
|
this->cam_position = tem.cam_position;
|
|
this->check_param_path = tem.check_param_path;
|
|
this->AIModel_param_path = tem.AIModel_param_path;
|
|
}
|
|
};
|
|
|
|
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
|
|
{
|
|
CAMERA_POSITION cam_position; // 相机位置
|
|
DETECT_TYPE detect_type; // 检测类型
|
|
int Cam_Idx; // 对应的 相机 idx
|
|
int imgtype;
|
|
bool bdebugSaveImg; // 调试存图;
|
|
|
|
cv::Mat img;
|
|
long getImgTimeMs; // 获取图片的时间点
|
|
std::string imgstr;
|
|
std::string strImgName;
|
|
shareImage()
|
|
{
|
|
Cam_Idx = -1;
|
|
getImgTimeMs = 0;
|
|
imgtype = 0;
|
|
imgstr = "";
|
|
strImgName = "";
|
|
bdebugSaveImg = false;
|
|
}
|
|
};
|
|
|
|
// 结果信息
|
|
struct CheckResult
|
|
{
|
|
int checkStatus; // 检测状态 0 未检测
|
|
int nresult;
|
|
// 原始图片,输入检测的图片
|
|
std::shared_ptr<shareImage> in_shareImage; // 输入图片信息
|
|
cv::Mat resultImg;
|
|
|
|
std::vector<BlobResult> resultList; // 检测结果列表
|
|
|
|
float CenterOffsetX; //1109-add 偏移标记中心点的X坐标
|
|
float CenterOffsetY; //1109-add 偏移标记中心点的Y坐标
|
|
float OffsetAngle; //1109-add
|
|
|
|
cv::Mat rotatedROIimg; //1105-add
|
|
cv::Mat chipRoiImg; //1106-add 芯片区域最大外接矩形-第3幅图
|
|
cv::Mat chipMaskBigImg; //1106-add
|
|
cv::Mat LabelPolygonRectImg; //1107-add 相对于原始大图标记的多边形最大外接矩形图像 第4幅图
|
|
|
|
double UseTimeMS; // 耗时
|
|
|
|
CheckResult()
|
|
{
|
|
Init();
|
|
}
|
|
~CheckResult()
|
|
{
|
|
}
|
|
void Init()
|
|
{
|
|
nresult = 0;
|
|
checkStatus = 0;
|
|
|
|
if (!resultImg.empty())
|
|
{
|
|
resultImg.release();
|
|
}
|
|
resultList.clear();
|
|
UseTimeMS = 0;
|
|
}
|
|
};
|
|
|
|
#endif //_CORELOGICFACTORY_HPP_
|