1
|
using UnityEngine;
|
2
|
using System.Collections;
|
3
|
using System.Collections.Generic;
|
4
|
|
5
|
public interface DepthSensorInterface
|
6
|
{
|
7
|
// returns the depth sensor platform
|
8
|
KinectInterop.DepthSensorPlatform GetSensorPlatform();
|
9
|
|
10
|
// initializes libraries and resources needed by this sensor interface
|
11
|
// returns true if the resources are successfully initialized, false otherwise
|
12
|
bool InitSensorInterface(bool bCopyLibs, ref bool bNeedRestart);
|
13
|
|
14
|
// releases the resources and libraries used by this interface
|
15
|
void FreeSensorInterface(bool bDeleteLibs);
|
16
|
|
17
|
// checks if there is available sensor on this interface
|
18
|
// returns true if there are available sensors on this interface, false otherwise
|
19
|
bool IsSensorAvailable();
|
20
|
|
21
|
// returns the number of available sensors, controlled by this interface
|
22
|
int GetSensorsCount();
|
23
|
|
24
|
// opens the default sensor and inits needed resources. returns new sensor-data object
|
25
|
KinectInterop.SensorData OpenDefaultSensor(KinectInterop.FrameSource dwFlags, float sensorAngle, bool bUseMultiSource);
|
26
|
|
27
|
// closes the sensor and frees used resources
|
28
|
void CloseSensor(KinectInterop.SensorData sensorData);
|
29
|
|
30
|
// this method is invoked periodically to update sensor data, if needed
|
31
|
// returns true if update is successful, false otherwise
|
32
|
bool UpdateSensorData(KinectInterop.SensorData sensorData);
|
33
|
|
34
|
// gets next multi source frame, if one is available
|
35
|
// returns true if there is a new multi-source frame, false otherwise
|
36
|
bool GetMultiSourceFrame(KinectInterop.SensorData sensorData);
|
37
|
|
38
|
// frees the resources taken by the last multi-source frame
|
39
|
void FreeMultiSourceFrame(KinectInterop.SensorData sensorData);
|
40
|
|
41
|
// polls for new body/skeleton frame. must fill in all needed body and joints' elements (tracking state and position)
|
42
|
// returns true if new body frame is available, false otherwise
|
43
|
bool PollBodyFrame(KinectInterop.SensorData sensorData, ref KinectInterop.BodyFrameData bodyFrame, ref Matrix4x4 kinectToWorld, bool bIgnoreJointZ);
|
44
|
|
45
|
// polls for new color frame data
|
46
|
// returns true if new color frame is available, false otherwise
|
47
|
bool PollColorFrame(KinectInterop.SensorData sensorData);
|
48
|
|
49
|
// polls for new depth and body index frame data
|
50
|
// returns true if new depth or body index frame is available, false otherwise
|
51
|
bool PollDepthFrame(KinectInterop.SensorData sensorData);
|
52
|
|
53
|
// polls for new infrared frame data
|
54
|
// returns true if new infrared frame is available, false otherwise
|
55
|
bool PollInfraredFrame(KinectInterop.SensorData sensorData);
|
56
|
|
57
|
// performs sensor-specific fixes of joint positions and orientations
|
58
|
void FixJointOrientations(KinectInterop.SensorData sensorData, ref KinectInterop.BodyData bodyData);
|
59
|
|
60
|
// checks if the given body is turned around or not
|
61
|
bool IsBodyTurned(ref KinectInterop.BodyData bodyData);
|
62
|
|
63
|
// returns depth frame coordinates for the given 3d space point
|
64
|
Vector2 MapSpacePointToDepthCoords(KinectInterop.SensorData sensorData, Vector3 spacePos);
|
65
|
|
66
|
// returns 3d Kinect-space coordinates for the given depth frame point
|
67
|
Vector3 MapDepthPointToSpaceCoords(KinectInterop.SensorData sensorData, Vector2 depthPos, ushort depthVal);
|
68
|
|
69
|
// estimates all space coordinates for the current depth frame
|
70
|
// returns true on success, false otherwise
|
71
|
bool MapDepthFrameToSpaceCoords (KinectInterop.SensorData sensorData, ref Vector3[] vSpaceCoords);
|
72
|
|
73
|
// returns color-space coordinates for the given depth point
|
74
|
Vector2 MapDepthPointToColorCoords(KinectInterop.SensorData sensorData, Vector2 depthPos, ushort depthVal);
|
75
|
|
76
|
// estimates all color-space coordinates for the current depth frame
|
77
|
// returns true on success, false otherwise
|
78
|
bool MapDepthFrameToColorCoords(KinectInterop.SensorData sensorData, ref Vector2[] vColorCoords);
|
79
|
|
80
|
// estimates all depth-space coordinates for the current color frame
|
81
|
// returns true on success, false otherwise
|
82
|
bool MapColorFrameToDepthCoords (KinectInterop.SensorData sensorData, ref Vector2[] vDepthCoords);
|
83
|
|
84
|
// returns the index of the given joint in joint's array
|
85
|
int GetJointIndex(KinectInterop.JointType joint);
|
86
|
|
87
|
// // returns the joint at given index
|
88
|
// KinectInterop.JointType GetJointAtIndex(int index);
|
89
|
|
90
|
// returns the parent joint of the given joint
|
91
|
KinectInterop.JointType GetParentJoint(KinectInterop.JointType joint);
|
92
|
|
93
|
// returns the next joint in the hierarchy, as to the given joint
|
94
|
KinectInterop.JointType GetNextJoint(KinectInterop.JointType joint);
|
95
|
|
96
|
// returns true if the face tracking is supported by this interface, false otherwise
|
97
|
bool IsFaceTrackingAvailable(ref bool bNeedRestart);
|
98
|
|
99
|
// initializes libraries and resources needed by the face tracking subsystem
|
100
|
bool InitFaceTracking(bool bUseFaceModel, bool bDrawFaceRect);
|
101
|
|
102
|
// releases the resources and libraries used by the face tracking subsystem
|
103
|
void FinishFaceTracking();
|
104
|
|
105
|
// this method gets invoked periodically to update the face tracking state
|
106
|
// returns true if update is successful, false otherwise
|
107
|
bool UpdateFaceTracking();
|
108
|
|
109
|
// returns true if face tracking is initialized, false otherwise
|
110
|
bool IsFaceTrackingActive();
|
111
|
|
112
|
// returns true if face rectangle(s) must be drawn in color map, false otherwise
|
113
|
bool IsDrawFaceRect();
|
114
|
|
115
|
// returns true if the face of the specified user is being tracked at the moment, false otherwise
|
116
|
bool IsFaceTracked(long userId);
|
117
|
|
118
|
// gets the face rectangle in color coordinates. returns true on success, false otherwise
|
119
|
bool GetFaceRect(long userId, ref Rect faceRect);
|
120
|
|
121
|
// visualizes face tracker debug information
|
122
|
void VisualizeFaceTrackerOnColorTex(Texture2D texColor);
|
123
|
|
124
|
// gets the head position of the specified user. returns true on success, false otherwise
|
125
|
bool GetHeadPosition(long userId, ref Vector3 headPos);
|
126
|
|
127
|
// gets the head rotation of the specified user. returns true on success, false otherwise
|
128
|
bool GetHeadRotation(long userId, ref Quaternion headRot);
|
129
|
|
130
|
// gets the AU values for the specified user. returns true on success, false otherwise
|
131
|
bool GetAnimUnits(long userId, ref Dictionary<KinectInterop.FaceShapeAnimations, float> afAU);
|
132
|
|
133
|
// gets the SU values for the specified user. returns true on success, false otherwise
|
134
|
bool GetShapeUnits(long userId, ref Dictionary<KinectInterop.FaceShapeDeformations, float> afSU);
|
135
|
|
136
|
// returns the length of model's vertices array for the specified user
|
137
|
int GetFaceModelVerticesCount(long userId);
|
138
|
|
139
|
// gets the model vertices for the specified user. returns true on success, false otherwise
|
140
|
bool GetFaceModelVertices(long userId, ref Vector3[] avVertices);
|
141
|
|
142
|
// returns the length of model's triangles array
|
143
|
int GetFaceModelTrianglesCount();
|
144
|
|
145
|
// gets the model triangle indices. returns true on success, false otherwise
|
146
|
bool GetFaceModelTriangles(bool bMirrored, ref int[] avTriangles);
|
147
|
|
148
|
// returns true if the face tracking is supported by this interface, false otherwise
|
149
|
bool IsSpeechRecognitionAvailable(ref bool bNeedRestart);
|
150
|
|
151
|
// initializes libraries and resources needed by the speech recognition subsystem
|
152
|
int InitSpeechRecognition(string sRecoCriteria, bool bUseKinect, bool bAdaptationOff);
|
153
|
|
154
|
// releases the resources and libraries used by the speech recognition subsystem
|
155
|
void FinishSpeechRecognition();
|
156
|
|
157
|
// this method gets invoked periodically to update the speech recognition state
|
158
|
// returns true if update is successful, false otherwise
|
159
|
int UpdateSpeechRecognition();
|
160
|
|
161
|
// loads new grammar file with the specified language code
|
162
|
int LoadSpeechGrammar(string sFileName, short iLangCode, bool bDynamic);
|
163
|
|
164
|
// adds a phrase to the from-rule in dynamic grammar. if the to-rule is empty, this means end of the phrase recognition
|
165
|
int AddGrammarPhrase(string sFromRule, string sToRule, string sPhrase, bool bClearRulePhrases, bool bCommitGrammar);
|
166
|
|
167
|
// sets the required confidence of the recognized phrases (must be between 0.0f and 1.0f)
|
168
|
void SetSpeechConfidence(float fConfidence);
|
169
|
|
170
|
// returns true if speech start has been detected, false otherwise
|
171
|
bool IsSpeechStarted();
|
172
|
|
173
|
// returns true if speech end has been detected, false otherwise
|
174
|
bool IsSpeechEnded();
|
175
|
|
176
|
// returns true if a grammar phrase has been recognized, false otherwise
|
177
|
bool IsPhraseRecognized();
|
178
|
|
179
|
// returns the confidence of the currently recognized phrase, in range [0, 1]
|
180
|
float GetPhraseConfidence();
|
181
|
|
182
|
// returns the tag of the recognized grammar phrase, empty string if no phrase is recognized at the moment
|
183
|
string GetRecognizedPhraseTag();
|
184
|
|
185
|
// clears the currently recognized grammar phrase (prepares SR system for next phrase recognition)
|
186
|
void ClearRecognizedPhrase();
|
187
|
|
188
|
// returns true if the background removal is supported by this interface, false otherwise
|
189
|
bool IsBackgroundRemovalAvailable(ref bool bNeedRestart);
|
190
|
|
191
|
// initializes libraries and resources needed by the background removal subsystem
|
192
|
bool InitBackgroundRemoval(KinectInterop.SensorData sensorData, bool isHiResPrefered);
|
193
|
|
194
|
// releases the resources and libraries used by the background removal subsystem
|
195
|
void FinishBackgroundRemoval(KinectInterop.SensorData sensorData);
|
196
|
|
197
|
// this method gets invoked periodically to update the background removal
|
198
|
// returns true if update is successful, false otherwise
|
199
|
bool UpdateBackgroundRemoval(KinectInterop.SensorData sensorData, bool isHiResPrefered, Color32 defaultColor, bool bAlphaTexOnly);
|
200
|
|
201
|
// returns true if background removal is initialized, false otherwise
|
202
|
bool IsBackgroundRemovalActive();
|
203
|
|
204
|
// returns true if BR-manager supports high resolution background removal
|
205
|
bool IsBRHiResSupported();
|
206
|
|
207
|
// returns the rectange of the foreground frame
|
208
|
Rect GetForegroundFrameRect(KinectInterop.SensorData sensorData, bool isHiResPrefered);
|
209
|
|
210
|
// returns the length of the foreground frame in bytes
|
211
|
int GetForegroundFrameLength(KinectInterop.SensorData sensorData, bool isHiResPrefered);
|
212
|
|
213
|
// polls for new foreground frame data
|
214
|
// returns true if foreground frame is available, false otherwise
|
215
|
bool PollForegroundFrame(KinectInterop.SensorData sensorData, bool isHiResPrefered, Color32 defaultColor, bool bLimitedUsers, ICollection<int> alTrackedIndexes, ref byte[] foregroundImage);
|
216
|
|
217
|
}
|