-
Notifications
You must be signed in to change notification settings - Fork 0
/
multithread.h
80 lines (57 loc) · 1.6 KB
/
multithread.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
#ifndef MULTITHREAD_H
#define MULTITHREAD_H
#include <QThread>
#include <QString>
#include <iostream>
#include <string>
#include <QDir>
#include<opencv2/opencv.hpp>
#include <atomic>
#include <QApplication>
#include <QMutex>
#include <time.h>
#include <QWaitCondition>
#include <chrono>
#include <thread>
class MultiThread : public QThread
{
Q_OBJECT
public:
MultiThread(std::string winName, int cam, std::atomic<bool> *checked, std::atomic<int> *waitSync, cv::Mat frame);
~MultiThread();
bool updateGUI;
void run() override
{ record_cam(); }
// void configureCaption(std::string fileName, int fourcc);
//Configura e grava
void record_cam();
//Regrava o video com fps correto
void configureCaption(std::string tempFile, std::string newFile, int fourcc);
//Setters
void setFileName(QString filename);
void setCam(int camera);
private:
//given parameters
QString m_filename; //Filename .avi
std::string m_winName;//Opencv window name
int m_cam; //Cam to record
cv::Mat m_frame; //Frame of video
QMutex mutex;//Local Mutex???
std::atomic_bool *m_recordChecked; //Pause stop variable
std::atomic<int> *m_waitSync; // Sync variable
int m_fps;
int width;
int height;
// Para guardar o tempo de gravacao
double seconds;
//Camera
cv::VideoCapture videoCam;
private slots:
signals:
//Envia cv::Mat frame para o main, da erro imshow em qthread
void sendFrame(std::string winName, const cv::Mat frame);
void sendWindow();
void sendFinishRecord();
void returnIfNoCam();
};
#endif // MULTITHREAD_H