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.
79 lines
1.6 KiB
79 lines
1.6 KiB
/*
|
|
//实现对部分缺陷 需要进行 数量 和距离上分析的
|
|
*/
|
|
#ifndef AI_Mark_Det_H_
|
|
#define AI_Mark_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"
|
|
|
|
using namespace std;
|
|
using namespace cv;
|
|
|
|
// 二次分割求面积
|
|
class AI_Mark_Det : public AIDetectBase
|
|
{
|
|
public:
|
|
// 检测参数和结果
|
|
struct DetConfigResult
|
|
{
|
|
|
|
int ncamID;
|
|
int nresult;
|
|
cv::Rect searchroi;
|
|
std::string strChannel;
|
|
bool bsaveprocessimg;
|
|
|
|
cv::Rect markRoi;
|
|
|
|
DetConfigResult()
|
|
{
|
|
|
|
nresult = -1;
|
|
ncamID = 0;
|
|
strChannel = "";
|
|
searchroi = cv::Rect(0, 0, 0, 0);
|
|
bsaveprocessimg = false;
|
|
markRoi = cv::Rect(0, 0, 0, 0);
|
|
}
|
|
};
|
|
|
|
public:
|
|
AI_Mark_Det(/* args */);
|
|
~AI_Mark_Det();
|
|
int InitModel_ALL();
|
|
int Detect(const cv::Mat &img, DetConfigResult *pDetConfig);
|
|
|
|
private:
|
|
int InitModel();
|
|
|
|
cv::Rect GetCutRoi(cv::Rect &roi, const cv::Mat &img);
|
|
|
|
int Det_img(const cv::Mat &img, DetConfigResult *pDetConfig);
|
|
|
|
// 分析结果
|
|
int Analysisy(const cv::Mat &maskImg, DetConfigResult *pDetConfig);
|
|
|
|
// 存储过程图片
|
|
int SaveProcessImg(const cv::Mat &inImg, const cv::Mat &outImg, const cv::Mat &oldmask, DetConfigResult *pDetConfig);
|
|
|
|
private:
|
|
bool m_bModelSucc;
|
|
cv::Mat detimg123;
|
|
ImageStorage *m_pImageStorage;
|
|
|
|
int m_Show_Area;
|
|
float m_Show_Len;
|
|
cv::Point m_Len_P1;
|
|
cv::Point m_Len_P2;
|
|
|
|
private:
|
|
/* data */
|
|
};
|
|
|
|
#endif |