-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVideoCaptureThread.h
More file actions
61 lines (49 loc) · 1.89 KB
/
VideoCaptureThread.h
File metadata and controls
61 lines (49 loc) · 1.89 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
#ifndef VIDEOCAPTURETHREAD_H
#define VIDEOCAPTURETHREAD_H
#include<QDebug>
#include<QThread>
#include<QObject>
#include<QElapsedTimer>
#include<QVideoFrame>
#include <QMutex>
#include <QWaitCondition>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/videoio/videoio_c.h>
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/imgproc/types_c.h>
#include<vector>
#include"VideoCaptureWrapper.h"
#include "LaneDetection.h"
using namespace cv;
#ifdef QT_DEBUG
#define DPRINT(...) qDebug(__VA_ARGS__)
#else
#define DPRINT(...) while(0);
#endif
class VideoCaptureThread : public QThread
{
Q_OBJECT
public:
explicit VideoCaptureThread(QObject *parent = nullptr);
~VideoCaptureThread();
void setParameters(QMutex* lock, QWaitCondition* conImageReady, VideoCaptureWrapper* camera, QVideoFrame* videoFrame, unsigned char* cvImageBuf, int width, int height);
private:
#if defined(QT_DEBUG) && !defined(ANDROID) //Android camera has its own FPS debug info
const float CAM_FPS_RATE = 0.9f; ///< Rate of using the older FPS estimates
const int CAM_FPS_PRINT_PERIOD = 500; ///< Period of printing the FPS estimate, in milliseconds
#endif
QMutex* lock;
QWaitCondition* conImageReady;
int width; ///< Width of the camera image
int height; ///< Height of the camera image
VideoCaptureWrapper* camera; ///< The camera to get data from
bool running = false; ///< Whether the worker thread is running
QVideoFrame* videoFrame; ///< Place to draw camera image to
unsigned char* cvImageBuf; ///< Place to export camera image to
LaneDetection* processor;
protected:
void run() override;
signals:
void imageReady();
};
#endif // VIDEOCAPTURETHREAD_H