-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathcalibratorform.h
74 lines (63 loc) · 1.8 KB
/
calibratorform.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// CalibratorForm class: Do all calibration steps
// Author: @ZC
// Date: created on 05 Sep 2018
#ifndef CALIBRATORFORM_H
#define CALIBRATORFORM_H
#include <QWidget>
#include <QDebug>
#include <QMessageBox>
#include <QFile>
#include <unistd.h> // for usleep()
#include <math.h>
#include <iostream>
using namespace std;
#include "opencv2/opencv.hpp"
#include "opencv2/imgproc.hpp"
using namespace cv;
namespace Ui {
class CalibratorForm;
}
class CalibratorForm : public QWidget
{
Q_OBJECT
public:
explicit CalibratorForm(QWidget *parent = nullptr);
~CalibratorForm();
signals:
void sendFrameRequest();
void sendFrameToShow(cv::Mat frame);
void sendUpdateConfig();
void sendCaliCommand(QString command);
public slots:
void receiveFrame(cv::Mat frame);
void receiveMousePressedPosition(QPoint& pos);
private slots:
void on_pushButtonBGStart_clicked();
void on_pushButtonRulerStart_clicked();
void on_pushButtonCalculate_clicked();
void receiveCancelForm();
void receiveOkForm();
void receiveSetButtonVisible(QString input);
void on_pushButtonRulerSelect_clicked();
void on_pushButtonRulerSelectStop_clicked();
private:
Ui::CalibratorForm *ui;
cv::Mat frameCopy, roiBGFrame, roiRLFrame, roiRLFrame2Show;
cv::Mat thresholdImg, contourImg;
cv::Scalar bgMeanBGR, bgMeanHSV, bgMeanGS;
cv::Scalar objMeanBGR, objMeanHSV, objMeanGS;
cv::Rect ROI;
bool newFrameAvaviable = false;
double pixelDistance, pixelPERmm;
void initialSetup();
void extractBGColorMean();
void extractObjColorMean(cv::Mat image);
void autoCalibrateRuler();
void manualCalibrateRuler();
void hsvThreshold();
void diffThreshold();
void grayscaleThreshold();
void getContour();
void writeCaliConf();
};
#endif // CALIBRATORFORM_H