You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.5 KiB
C
58 lines
1.5 KiB
C
|
5 years ago
|
#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 roi;
|
||
|
|
LP_DETECTOR_ROI_DATA barROI;
|
||
|
|
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;
|
||
|
|
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
|