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.
BOE_FOG_DETECT/AlgorithmModule/include/AI_Edge_QX_Det.h

79 lines
1.9 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*
//实现对部分缺陷 需要进行 数量 和距离上分析的
*/
#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();
/// @brief 边缘缺陷检测,检测结果根据配置参数合并到 mask
/// @param img 检测原图
/// @param detmask 合并目标 mask(主检测)
/// @param pDetConfig 检测参数
/// @param pdetlog 日志
/// @param pDetmask2 可选:第二个合并目标 mask(如弱线检测mask),按与主检测相同规则合并
int Detect(const cv::Mat &img, cv::Mat &detmask, DetConfig *pDetConfig, std::shared_ptr<DetLog> pdetlog, cv::Mat *pDetmask2 = nullptr);
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