JunkBox_Win_Lib 1.5.3
Loading...
Searching...
No Matches
OpenNiWin.h
Go to the documentation of this file.
1#pragma once
2
3#if defined(ENABLE_OPENNI) || defined(ENABLE_OPENNI2)
4
5#include "OpenNiTool.h"
6#include "NiToolWin.h"
7
8//#include "WinAudioTool.h"
9#include "OpenNiAudio.h"
10
11#include "ExView.h"
12#include "Rotation.h"
13#include "RingBuffer.h"
14
15#include "NiSpeech.h"
16
17
18// Lib
19#ifdef ENABLE_OPENNI2
20 #pragma comment(lib, "OpenNI2.lib")
21 #pragma comment(lib, "NiTE2.lib")
22#else
23 #ifdef WIN64
24 #pragma comment(lib, "OpenNI64.lib")
25 #pragma comment(lib, "XnVNITE64_1_5_2.lib")
26 #else
27 #pragma comment(lib, "OpenNI.lib")
28 #pragma comment(lib, "XnVNITE_1_5_2.lib")
29 #endif
30#endif
31
32
33//
34namespace jbxwl {
35
36using namespace jbxl;
37
38
39class COpenNiWin : public COpenNiTool
40{
41public:
42// COpenNiWin(void);
43 COpenNiWin(NiSDK_Lib lib);
44 virtual ~COpenNiWin(void) { free();}
45
46private:
47 COpenNiAudio* audio;
48 CNiSpeech* speech;
49
50public:
51 NiSDK_Lib m_library;
52 CString m_err_mesg;
53
54 int m_image_scale;
55 int m_depth_scale;
56 int m_skeleton_line;
57
58 BOOL m_is_tracking;
59 BOOL m_is_detected;
60 BOOL m_is_mirroring;
61
62 BOOL m_use_image;
63 BOOL m_use_led;
64 BOOL m_use_motor;
65 BOOL m_use_face;
66 BOOL m_use_speech;
67
68 BOOL m_enable_face;
69 BOOL m_enable_speech;
70 BOOL m_enable_motor;
71
72 BOOL m_use_nite_smth;
73 BOOL m_force_pose;
74
75 int m_profile;
76 double m_confidence;
77 double m_nite_smooth;
78 double m_ground_level;
79
80public:
81 ExCmnHead* pViewData;
82 ExCmnHead* pDepthData;
83
84 BOOL hasDepthData;
85 BOOL hasUserData;
86 BOOL isDetectShadow;
87 BOOL isDetectFace;
88
89public:
90 BOOL init(void);
91 void free(void);
92
93 CString get_err_message(void);
94
95public:
96 //
97 void deleteDevice(void) { delete_Device();}
98 void clearJointsData(void);
99 void clearAvatarDetected(void);
100 BOOL checkAvatarDetected(void);
101
102 BOOL openUSBDevice(void) { return open_USBDevice();}
103 void closeUSBDevice(void) { close_USBDevice();}
104 void setLEDColor(int col) { if (m_use_led) set_LEDColor(col);}
105 void setTiltMotor(int ang);
106
107 void setMirroring(BOOL mirror);
108// int getDevState(void) { return m_state;}
109
110// BOOL startDetection(BOOL force_pose);
111 BOOL startDetection(void);
112 BOOL stopDetection(void);
113 BOOL restartDetection(void);
114
115 unsigned int getTrackingUser(void) { return get_TrackingUser();}
116 void setDenyTrackingSearch(unsigned int user) { set_DenyTrackingSearch(user);}
117
118 //
119 void getJointsPosData(unsigned int uid);
120 void getJointsRotData(unsigned int uid);
121
122 //
123 void makeDisplayImage(void);
124 void makeDisplayDepth(CExView* pview);
125 BOOL trackingJoints(BOOL use_rot_data);
126
127 //
128 BOOL detectShadow(void);
129 void paintShadow(void);
130 void drawSkeleton(int col, int line);
131 void drawJointConnection(int j1, int j2, int col, int line);
132 void set2DCoordinate(void);
133
134 //
135 BOOL initRingBuffer(void);
136 void freeRingBuffer(void);
137 void clearRingBuffer(void);
138 void backup2RingBuffer(void);
139
140public:
141 // Face
142// Quaternion getFaceRotation(void) {};
143
144public:
145 // Speech  作成中
146 BOOL initSpeech(void);
147 BOOL createSpeech(LPCTSTR lang, LPCTSTR grfile);
148 BOOL startSpeech(double confidence);
149 void stopSpeech(void);
150 void deleteSpeech(BOOL rls=TRUE); // rls: メンバをリリースするか?
151
152 void setSpeechConfidence(double confd) { if (speech!=NULL) speech->setConfidence(confd);}
153
154 virtual CNiSpeech* makeSpeech(void) { CNiSpeech* spch = new CNiSpeech(); return spch;}
155
156public:
157 virtual void saveJointsData(void) {}
158 virtual void loggingJointsData(void) {}
159
160 virtual void checkBoneLength(void) {}
161 virtual void checkGroundLevel(void) {}
162
163 virtual void convertJointsData(void) {}
164 virtual void drawAddition(int col, int line) {}
165
166 virtual void lostTrackingUser(int uid) {}
167 virtual void detectTrackingUser(int uid) {}
168
169public:
170 // Data
171 Vector<double> startPos;
172 Vector<double> currentPos;
173
174 Vector<double> posVect[OPENNI_JOINT_NUM];
175 Vector<int> crdVect[OPENNI_JOINT_NUM]; // for 2D Image
176 Quaternion<double> rotQuat[OPENNI_JOINT_NUM];
177
178 double jntAngl[OPENNI_JOINT_NUM]; // angle between joints.
179
180 CRingBuffer posRing[OPENNI_JOINT_NUM];
181 CRingBuffer rotRing[OPENNI_JOINT_NUM];
182};
183
184
185} // namespace
186
187
188#endif
Speech Platform クラス ヘッダ
NiSDK_Lib
Definition NiToolWin.h:35