|
|
|
|
|
#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;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
LP_DETECTOR_ROI_DATA barROI;//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
LP_DETECTOR_ROI_DATA startROI;//<2F>ο<EFBFBD><CEBF><EFBFBD>λ<EFBFBD>ñ궨<C3B1><EAB6A8><EFBFBD><EFBFBD>
|
|
|
|
|
|
int flagCircle;
|
|
|
|
|
|
|
|
|
|
|
|
Point2f ptCenter;
|
|
|
|
|
|
int barNum;
|
|
|
|
|
|
const int nAngleMax = 3600;
|
|
|
|
|
|
int backgroundThresh;
|
|
|
|
|
|
int ifClasify;
|
|
|
|
|
|
int ibackground;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct OutputParam
|
|
|
|
|
|
{
|
|
|
|
|
|
float fValveDis;
|
|
|
|
|
|
float fValveWidth;
|
|
|
|
|
|
Mat imgTemplate;
|
|
|
|
|
|
int nValveOffset;//<2F><><EFBFBD><EFBFBD>о<EFBFBD><D0BE><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>ĽǶ<C4BD>ƫ<EFBFBD><C6AB>ֵ
|
|
|
|
|
|
int nStartOffset;//<2F>ο<EFBFBD><CEBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>ĽǶ<C4BD>ƫ<EFBFBD><C6AB>ֵ
|
|
|
|
|
|
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
|