-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdetect2d.hpp
45 lines (37 loc) · 1.45 KB
/
detect2d.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//Scratch detection (No Chinese)
#ifndef DETECT2D_HPP
#define DETECT2D_HPP
#include <stdio.h>
#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include "opencv2/features2d.hpp"
#include "config.hpp"
using namespace cv;
using namespace std;
void pitsdetect(cv::Mat imgFCN, ::Mat img);
class detect2d
{
private:
int minRow, maxRow, minCol, maxCol;
cv::Mat preProcess(cv::Mat inputImage);
cv::Mat silkMask(cv::Mat inputImage,cv::Mat edgeMask, cv::Mat adpROI);
void edgeCut(cv::Mat inputImage);
cv::Mat edgeMake(cv::Mat origin);
void showDefect(cv::Mat finalShow, cv::Mat inputImage);
string edgeDetect(cv::Mat inputImage, cv::Mat edgeMask);
string blackDetect(cv::Mat inputImage, cv::Mat edgeMask);
string alDetect(cv::Mat origin, cv::Mat inputImage, vector<vector<Point>>& contoursAl);
string scratchDetect(cv::Mat origin, cv::Mat inputImage);
string liquidDetect(cv::Mat origin, cv::Mat inputImage, vector<vector<Point>>& contoursLiquid);
string dirtyDetect(cv::Mat adpModel, cv::Mat imageScratch, cv::Mat imageDirty);
public:
//Confirm the surface in function "silkMask"
int surfaceIndex;//1 for English face, 2 for Chinese face
cv::Mat drawResult(cv::Mat src, cv::Mat imgFCN);
int batteryKind;
string scratchCheck(cv::Mat image, cv::Mat& silkModel2d, vector<vector<Point>>& contoursAl, vector<vector<Point>>& contoursLiquid);
};
#endif