#ifndef LP_VALVE_DETECTOR_H #define LP_VALVE_DETECTOR_H #include "Luffy.h" #include "lpbengine.h" using namespace luffy_base; struct InputParam { LP_DETECTOR_ROI_DATA valueROI;//其门下模板参数 LP_DETECTOR_ROI_DATA barROI;//辐条模板参数 LP_DETECTOR_ROI_DATA startROI;//参考线位置标定参数 int flagCircle; Point2f ptCenter; int barNum; const int nAngleMax = 3600; int backgroundThresh; int ifClasify; int ibackground; }; struct OutputParam { float fValveDis;//气门芯离圆心坐标的距离 后续定位时用到 通过该参数截取指定大学的图像 float fValveWidth; float fStartDis;// Mat imgTemplate; int nValveOffset;//气门芯距离圆心坐标系的角度偏移值 int nStartOffset;//参考点距离圆心坐标系的角度偏移值 Mat barTemplate; int withinOffset; int barNum; int flagCircle; Mat baseImage; Mat background; Mat weightMat; }; class CaliValve { public: CaliValve(); ~CaliValve(); bool detect(Mat & imgSrc, InputParam ¶mIn, OutputParam ¶mOut, Mat &imgDst = Mat()); bool cutValve(Mat & img2Rect, Mat &imgTemplate, Rect rtCut, int nAngleMax); void preProcessImage(Mat& img, const Mat& mask, double dstMean, double dstStddev, int highlightsThreshold); Mat genMask(const Mat& img, Point2f center, float innerR = -1, float outterR = -1, int type = CV_32FC1); cv::Mat cocentricNorm(Mat& img, Point2f center, const Mat& weightMat, float dstMeanVal); float interpolate(float* pY, int n, float stepX, float x); Mat extractForegroundWheel(const Mat& background, const Mat& src); Mat findWheelObject(Mat src, Mat backGroundImg, int thresh); void selfRotateMin(const Mat& src, Mat &dst, int repeatNum); Mat rotateImage(const Mat& img, Point2f center, float degree); void colorConvert(const Mat& src, Mat & dst); }; #endif //LP_VALVE_DETECTOR_H