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.

73 lines
1.6 KiB

/*
//实现对部分缺陷 需要进行 数量 和距离上分析的
*/
#ifndef AI_Edge_QX_Det_H_
#define AI_Edge_QX_Det_H_
#include <opencv2/opencv.hpp>
#include "CheckUtil.hpp"
#include "OtherDetect.h"
#include "OtherDetBaseDefine.h"
#include "CheckErrorCodeDefine.hpp"
#include "ImageDetConfig.h"
#include "CheckConfigDefine.h"
#include "ImageStorage.h"
#include "AI_Factory.h"
using namespace std;
using namespace cv;
// 边缘缺陷检测
class AI_Edge_QX_Det
{
public:
/// @brief 检测过程的参数
struct DetConfig
{
std::shared_ptr<std::vector<cv::Rect>> pEdgeDet_roiList;
Function_Edge_Det *pdege_Det_config;
std::string strCamChannel;
cv::Rect CutRoi;
int ninstruct;
DetConfig()
{
Init();
}
void Init()
{
pdege_Det_config = NULL;
strCamChannel = "";
ninstruct = 0;
CutRoi = cv::Rect(0, 0, 0, 0);
}
};
public:
AI_Edge_QX_Det(/* args */);
~AI_Edge_QX_Det();
int Detect(const cv::Mat &img, cv::Mat &detmask, DetConfig *pDetConfig,std::shared_ptr<DetLog> pdetlog);
private:
int SaveProcessImg(const cv::Mat &inImg, const cv::Mat &outImg, bool isALLzeros, DetConfig *pDetConfig, int idx = 0, int nruntype = 0);
std::string GetImgSaveName(int flag = 0);
private:
bool m_bInitSucc; // 是否初始化成功
std::string m_strSaveImgRootPath;
std::string m_strSaveImgRootPath_OK;
std::string m_strSaveImgRootPath_Qx;
ImageStorage *m_pImageStorage;
DetConfig *m_pDetConfig;
std::shared_ptr<AIFactory> AI_Factory;
std::shared_ptr<DetLog> m_pdetlog;
int m_nImge_num;
std::string m_strCamChannel;
private:
/* data */
};
#endif