-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcamerathread.h
77 lines (52 loc) · 1.36 KB
/
camerathread.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
#ifndef CAMERATHREAD_H
#define CAMERATHREAD_H
#include <QThread>
#include <QImage>
#include <QMediaRecorder>
// Include standard OpenCV headers
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
class CameraThread : public QThread
{
Q_OBJECT
void run();
signals:
void qimgReady(int n, const QImage qimg);
void resultReady(const QString &s);
void cameraInfo(int, int, int);
void errorMessage(const QString &e);
public slots:
void setOutputDirectory(const QString &d);
void onStateChanged(QMediaRecorder::State);
void setCameraOutput(QString);
void setCameraFramerate(QString);
void setCameraPower(int, int);
public:
CameraThread(int i);
CameraThread(int i, QString wxh);
void breakLoop();
private:
QImage Mat2QImage(cv::Mat const& src);
/// Aspect ratio preserving resize
void resizeAR(cv::Mat &, cv::Size);
void setDefaultDesiredInputSize();
int framerate;
int fourcc;
int idx;
cv::Size desired_input_size;
cv::Size input_size;
bool record_video;
bool is_active, was_active;
cv::VideoWriter video;
cv::Size output_size;
cv::Size window_size;
QString outdir;
QString filename;
bool stopLoop;
};
#endif // CAMERATHREAD_H
// Local Variables:
// mode: c++
// c-basic-offset: 4
// End: