-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.h
More file actions
114 lines (84 loc) · 1.85 KB
/
mainwindow.h
File metadata and controls
114 lines (84 loc) · 1.85 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QListWidget>
#include <QVector>
#include "morphology.h"
#include "components.h"
#define k 3
#define rho 0.01
#define QueueLength 25
const qint64 fps = 20;
struct RgbColor
{
unsigned int R, G, B;
};
struct RgbColorF
{
float Rf, Gf, Bf;
};
namespace Ui {
class MainWindow;
}
class Gaussian
{
private:
float sigma[3][3];
float inver[3][3];
float sigma_k;
QList<RgbColor> points;
bool isNotFinalized;
bool usingRealTime;
bool usingFullMastrix;
bool usingHsv;
public:
float sigmamin;
RgbColorF mu;
float det;
float detSqrt;
float det3Rt;
Gaussian(float _sirmamin = 5, bool fullMatrix = true, bool hsv = false);
void finalize();
void addItem(QRgb x_);
//void addItemMix(QRgb x_);
float p(uchar x);
bool isBackground(QRgb x_);
};
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void openImages();
void clearImageList();
void play();
void recognize();
void learn();
void itemClicked(QListWidgetItem * item);
void spinSigmaMinChanged(double newValue);
public:
void playImages(QList<QImage*>& pixmap);
void substractBackground();
void substractBackground2();
void applyMasks();
QList<QImage *>* createBorders();
void applyBorders();
void getCentresOfMass();
QList<xy> centresOfMass;
private:
Ui::MainWindow *ui;
QVector<Gaussian*> backg;
void fillBackg(int n);
void clearBackg();
QImage* maskGradient(QImage *origin);
QList<QImage*> imageList;
QList<QImage*> masks;
QList<QImage*> imagesWithMasks;
int pixelCount;
float sigmamin;
void clearLists();
void convertToGrayscale(QImage &image);
};
#endif // MAINWINDOW_H