-
Notifications
You must be signed in to change notification settings - Fork 4
/
KinectV2.h
90 lines (63 loc) · 1.99 KB
/
KinectV2.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
#pragma once
//
// デプスセンサ関連の処理
//
// Kinect V2 を使う
#if !defined(USE_KINECT_V2)
# define USE_KINECT_V2 1
# ifdef SENSOR
# undef SENSOR
# endif
# define SENSOR KinectV2
#endif
#if USE_KINECT_V2
// Kinect 関連
#include <Windows.h>
#include <Kinect.h>
// デプスセンサ関連の基底クラス
#include "DepthCamera.h"
class KinectV2 : public DepthCamera
{
// センサの識別子
static IKinectSensor *sensor;
// 座標のマッピング
ICoordinateMapper *coordinateMapper;
// デプスデータ
IDepthFrameReader *depthReader;
// デプスデータの計測不能点を変換するために用いる一次メモリ
std::vector<GLushort> depth;
// デプスデータからカメラ座標を求めるときに用いる一時メモリ
std::vector<Point> point;
// デプス値に対するカメラ座標の変換テーブルのテクスチャ
GLuint mapperTexture;
// カラーデータ
IColorFrameReader *colorReader;
// カラーデータの変換に用いる一時メモリ
std::vector<GLubyte> color;
// カメラ座標を計算するシェーダ
static std::unique_ptr<Compute> shader;
// デプスデータのイメージユニットの uniform 変数 depth の場所
static GLint depthLoc;
// カメラ座標のイメージユニットの uniform 変数 point の場所
static GLint pointLoc;
// 変換テーブルのイメージユニットの uniform 変数 mapper の場所
static GLint mapperLoc;
public:
// コンストラクタ
KinectV2();
// デストラクタ
virtual ~KinectV2();
// 奥行きの最大値
static constexpr GLushort maxDepth = 10000;
// 疑似カラー処理の範囲
static constexpr GLfloat range[2] = { 0.5f, 8.0f };
// デプスデータを取得する
GLuint getDepth();
// カメラ座標を取得する
GLuint getPoint();
// カメラ座標を算出する
GLuint KinectV2::getPosition();
// カラーデータを取得する
GLuint getColor();
};
#endif