-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathmeasuretool.h
44 lines (36 loc) · 1.01 KB
/
measuretool.h
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
// MeasureTool class: measure part size
// Author: @ZC
// Date: created on 20 Sep 2018
#ifndef MEASURETOOL_H
#define MEASURETOOL_H
#include <QObject>
#include <QDebug>
#include <stdio.h>
using namespace std;
#include "opencv2/opencv.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
using namespace cv;
class MeasureTool : public QObject
{
Q_OBJECT
public:
explicit MeasureTool(QObject *parent = nullptr);
signals:
void sendMeasurement(double length, bool color);
void sendFrameToShow(cv::Mat image);
public slots:
void receiveFrame(cv::Mat frame);
void receiveCalibrationPara(double pPmm, int test);
private:
cv::Mat frameCopy, bgImage, roiShow, thresholdImage;
cv::Rect ROI;
double pixelPERmm, realDistance;
bool isColorOK = true, isContourExist = true;
void diffSegmentation();
void getContours();
vector<Point> getMaxContour(vector<vector<Point>> allContours);
void cannySegmentation();
bool checkColor(cv::Mat image);
};
#endif // MEASURETOOL_H