-
Notifications
You must be signed in to change notification settings - Fork 0
/
klcontroller.h
146 lines (123 loc) · 3.18 KB
/
klcontroller.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#ifndef KLCONTROLLER_H
#define KLCONTROLLER_H
#include <QThread>
#include <QVector2D>
#include <QColor>
#include "Kinect.h"
#include "Kinect.Face.h"
#include <QDebug>
#include <iostream>
#include "klcheckthread.h"
#include "klcommon.h"
struct KLFaceData{
KLFaceData()
{
reset();
}
void reset(){
isValid = false;
sourceHD = NULL;
readerHD = NULL;
//frameHD = NULL;
index = 0;
//trackID = 0;
}
int index;
int trackID;
bool isValid;
IHighDefinitionFaceFrameSource* sourceHD;
IHighDefinitionFaceFrameReader* readerHD;
IHighDefinitionFaceFrame* frameHD;
};
class KLController: public QThread
{
Q_OBJECT
public:
enum SOURCE_TYPE{
S_NONE = 0x0,
S_COLOR = 0x1,
S_AUDIO = 0x2,
S_BODY = 0x4,
S_BODY_INDEX = 0x8,
S_DEPTH = 0x10,
S_INFRARED = 0x20,
S_LONG_EXPOSURE_INFRARED = 0x40,
S_MULTI = 0x80,
S_FACE_HD = 0x100,
S_FACE = 0x400,
S_ALL = 0xFFF
};
enum RESOURCE_TYPE {
R_NONE = 0x0,
R_COLOR = 0x1,
R_AUDIO = 0x2,
R_BODY = 0x4,
R_BODY_INDEX = 0x8,
R_DEPTH = 0x10,
R_INFRARED = 0x20,
R_LONG_EXPOSURE_INFRARED = 0x40,
R_FACE_HD = 0x1000,
};
static KLController& getInstance();
void setPollingRate(int fps);
void stop();
void close();
void open();
void startStream(int source = -1);
void stopStream();
bool isOpened();
bool isAvailable();
IKinectSensor* getSensor();
static const QColor* getBodyColor(int body_index);
ICoordinateMapper *getCoordMapper();
const IColorFrameReader* getReader(int source);
IFrameDescription *getFrameDesc(int source);
const int getSourceMarker();
public slots:
/* adapter slots */
void __hrError(HRESULT hr);
void h_connect(bool result);
void h_started();
void h_finished();
signals:
void _open(bool);
void _available(bool);
void _hrError(HRESULT);
void _readerInfo(bool, unsigned int);
void _stream(bool);
void _data(void*, unsigned int);
void _pulse();
protected:
void run();
private:
/* constructors */
KLController();
KLController(KLController const&);
KLController& operator=(KLController const&);
/* members */
int fps;
bool isStop;
IKinectSensor* sensor;
KLCheckThread* checkThread;
static const QColor* bodyColors[BODY_COUNT];
ICoordinateMapper* coordMapper;
unsigned int sourceMarker;
IColorFrameSource* colorSource;
IColorFrameReader* colorReader;
IFrameDescription* colorDesc;
int colorWidth;
int colorHeight;
UINT colorBytesPerPixel;
QVector<BYTE>* colorBuffer;
IFaceFrameReader* faceReaders[BODY_COUNT];
IDepthFrameReader* depthReader;
IBodyFrameReader* bodyReader;
IBody* bodies[BODY_COUNT];
/* HD face */
IHighDefinitionFaceFrameSource* faceHDSources[BODY_COUNT];
IHighDefinitionFaceFrameReader* faceHDReaders[BODY_COUNT];
IHighDefinitionFaceFrame* faceHDFrames[BODY_COUNT];
KLFaceData* faceData[BODY_COUNT];
//IHighDefinitionFaceFrameSource* faceHDSouc
};
#endif // KLCONTROLLER_H