JunkBox_Lib++ (for Windows) 1.10.1
Loading...
Searching...
No Matches
OpenNi2Device.h
Go to the documentation of this file.
1#ifndef __JBXL_OPENNI2_DEV_H_
2#define __JBXL_OPENNI2_DEV_H_
3
4#ifdef ENABLE_OPENNI2
5
6#ifdef WIN32
7//#pragma warning(disable:4996)
8#pragma warning(disable:4005) // INT8_MIN etc マクロの再定義
9#endif
10
11#include <OpenNI.h>
12#include <NiTE.h>
13
14#include "NiDevice.h"
15#include "common++.h"
16#include "tools++.h"
17#include "buffer.h"
18
19//
20namespace jbxl {
21
22
23#define OPENNI2_DEVICE_PS1080 "PS1080"
24#define OPENNI2_DEVICE_KINECT "Kinect"
25#define OPENNI2_DEVICE_ONIFILE "oni File"
26
27//
28#define OPENNI2_STREAM_DATA_NUM 3
29
30#define OPENNI2_DEPTH_FLAG 0x01
31#define OPENNI2_IMAGE_FLAG 0x02
32//#define OPENNI2_AUDIO_FLAG 0x04
33
34#define OPENNI2_DEPTH_INDEX 0
35#define OPENNI2_IMAGE_INDEX 1
36//#define OPENNI2_AUDIO_INDEX 2
37
38
39class COpenNi2Device
40{
41public:
42 COpenNi2Device(void);
43 virtual ~COpenNi2Device(void) { free();}
44
45 ONI_EnuDev m_enu_dev;
46
47 int m_state;
48 BOOL m_has_camera;
49 Buffer m_err_mesg;
50 Buffer m_dev_name;
51
52 int m_xsize;
53 int m_ysize;
54 int m_nfps;
55
56public:
57 BOOL init(BOOL use_image);
58 BOOL init(char* fname, BOOL use_image);
59 void free(void);
60
61 // Generators
62 BOOL create_Context(char* fname=NULL);
63 BOOL create_Recorder(char* fname, BOOL use_image);
64
65 BOOL create_Image(void);
66 BOOL create_Depth(void);
67 BOOL create_User(void);
68
69 void delete_Context(void);
70 void delete_Recorder(void);
71
72 void delete_Image(void);
73 void delete_Depth(void);
74 void delete_User(void);
75
76public:
77 void wait_StreamData(void);
78
79 BOOL set_ImageData(void);
80 BOOL set_DepthData(void);
81 BOOL set_SceneData(void);
82
83 uByte* get_ImageData(void) { if (imageFrame.isValid()) return (uByte*)imageFrame.getData(); else return NULL;}
84 uByte* get_DepthData(void) { if (depthFrame.isValid()) return (uByte*)depthFrame.getData(); else return NULL;}
85 uByte* get_SceneData(void) { if (userFrame.isValid()) return (uByte*)userFrame.getUserMap().getPixels(); else return NULL;}
86
87public:
88 openni::Device* context;
89
90 openni::VideoStream* image;
91 openni::VideoStream* depth;
92// openni::VideoStream* audio;
93
94 openni::VideoFrameRef imageFrame;
95 openni::VideoFrameRef depthFrame;
96// openni::VideoFrameRef audioFrame;
97
98 openni::VideoMode imageMode;
99 openni::VideoMode depthMode;
100
101 openni::Recorder* recorder;
102
103 // NiTE
104 nite::UserTracker* user;
105 nite::UserTrackerFrameRef userFrame;
106
107private:
108 unsigned char m_stream_flg;
109 int m_stream_num;
110 BOOL m_has_image_data;
111 BOOL m_has_depth_data;
112// BOOL m_has_audio_data;
113
114 openni::VideoStream* m_streams[OPENNI2_STREAM_DATA_NUM];
115
116public:
117 //
118 BOOL setup_Tracking(int profile, double smooth);
119
120 // File
121 BOOL start_Recorde(char* file_name, BOOL use_image);
122 void stop_Recorde(void);
123
124public:
125 // USB
126 BOOL open_USB_Device (void) { return FALSE;}
127 void close_USB_Device(void) {}
128 void set_LED_Color (int col) {}
129 void set_Tilt_Motor(int ang) {}
130};
131
132
133
135//
136
137Buffer initialize_OpenNI2(void);
138void shutdown_OpenNI2(void);
139
140Buffer initialize_NiTE2(void);
141void shutdown_NiTE2(void);
142
143
144} // namespace
145
146
147#endif // ENABLE_OPENNI2
148
149#endif
ONI_EnuDev
Definition NiDevice.h:17
Buffer型サポートヘッダ
Common Header for C++.
#define FALSE
Definition common.h:223
unsigned char uByte
1Byte
Definition common.h:332
Definition Brep.h:29
ツールライブラリ ヘッダ for C++