-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
119 lines (100 loc) · 2.83 KB
/
mainwindow.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
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
115
116
117
118
119
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QObject>
#include <QMenu>
#include <QToolBar>
#include <QAction>
#include <QStatusBar>
#include <QLabel>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QCheckBox>
#include <QPushButton>
#include <QListView>
#include <QMutex>
#include <string>
#include "capture_thread.h"
#include <opencv2/opencv.hpp>
class MainWindow: public QMainWindow
{
Q_OBJECT;
public:
explicit MainWindow(QWidget *parent=nullptr);
~MainWindow();
private:
// UI area dividing.
void initUI();
void initUIFileMenu();
void initUICameraMenu();
void initUIViewArea();
void initUIStatusBar();
void toggleHideActions(bool);
QString selectCamera();
void updateStatusBar(QString, QString, bool);
void updateStatusBar(bool);
private slots:
void cameraInfo();
void cameraOpen();
void doCameraMirror();
void stopCamera();
void calculateFPS();
void updateFrame(cv::Mat *mat);
void updateFgMask(cv::Mat *mat);
void updateBackgroundImage(cv::Mat *mat);
void updateFPS(float fps, int width, int height);
void recordingStartStop();
void updateVideoRecordStatus(int, QString );
void closeCapturer(bool);
void updateMonitorStatus(int);
void updateView(QGraphicsScene *scene, QGraphicsView *view, cv::Mat &image);
void togglePlayPause(bool);
private:
//------------------------
// initial UI variables
//------------------------
// file Menu and its action
QMenu *fileMenu;
QMenu *cameraMenu;
QToolBar *fileToolBar;
QToolBar *cameraToolBar;
QAction *cameraInfoAction;
QAction *cameraOpenAction;
QAction *exitAction;
QAction *stopCameraAction;
QAction *fpsCalculationAction;
QAction *cameraMirrorAction;
bool isCameraOpen = false;
// graphic scene and view needed as image handling
// for original frames
QGraphicsScene *imageScene1;
QGraphicsView *imageView1;
// for foreground mask
QGraphicsScene *imageScene2;
QGraphicsView *imageView2;
// for background image
QGraphicsScene *imageScene3;
QGraphicsView *imageView3;
// for other purpose not decided.
// or leave blank to split the screen into 4 parts
QGraphicsScene *imageScene4;
QGraphicsView *imageView4;
// status bar and label.
QStatusBar *mainStatusBar;
QMap<QString, QString> *mainStatusBarData;
QLabel *mainStatusLabel;
// as per the GUI plan
QCheckBox *monitorCheckBox;
QPushButton *recordButton;
QPushButton *playPauseButton;
QList<QString> *recordButtonText;
QList<QString> *playPauseButtonText;
bool clickedRecord=false;
QListView *saved_list;
cv::Mat currentframe;
cv::Mat currentFgMask;
cv::Mat currentBgImage;
QMutex *data_lock;
capture_thread *capturer;
};
#endif // MAINWINDOW_H