프로젝트

일반

사용자정보

통계
| 개정판:

t1 / TFDContents / Assets / KinectScripts / Interfaces / DummyK2Interface.cs @ 3

이력 | 보기 | 이력해설 | 다운로드 (9.51 KB)

1
using UnityEngine;
2
using System.Collections;
3

    
4
public class DummyK2Interface : DepthSensorInterface
5
{
6
	public KinectInterop.DepthSensorPlatform GetSensorPlatform ()
7
	{
8
		return KinectInterop.DepthSensorPlatform.DummyK2;
9
	}
10

    
11
	public bool InitSensorInterface (bool bCopyLibs, ref bool bNeedRestart)
12
	{
13
		bNeedRestart = false;
14
		return true;
15
	}
16

    
17
	public void FreeSensorInterface (bool bDeleteLibs)
18
	{
19
	}
20

    
21
	public bool IsSensorAvailable ()
22
	{
23
		return true;
24
	}
25

    
26
	public int GetSensorsCount ()
27
	{
28
		return 1;
29
	}
30

    
31
	public KinectInterop.SensorData OpenDefaultSensor (KinectInterop.FrameSource dwFlags, float sensorAngle, bool bUseMultiSource)
32
	{
33
		KinectInterop.SensorData sensorData = new KinectInterop.SensorData();
34

    
35
		sensorData.bodyCount = 6;
36
		sensorData.jointCount = 25;
37

    
38
		sensorData.depthCameraFOV = 60f;
39
		sensorData.colorCameraFOV = 53.8f;
40
		sensorData.depthCameraOffset = 0f;
41
		sensorData.faceOverlayOffset = 0f;
42

    
43
		sensorData.colorImageWidth = 1920;
44
		sensorData.colorImageHeight = 1080;
45

    
46
		sensorData.depthImageWidth = 512;
47
		sensorData.depthImageHeight = 424;
48

    
49
		Debug.Log("DummyK2-sensor opened");
50

    
51
		return sensorData;
52
	}
53

    
54
	public void CloseSensor (KinectInterop.SensorData sensorData)
55
	{
56
		Debug.Log("DummyK2-sensor closed");
57
	}
58

    
59
	public bool UpdateSensorData (KinectInterop.SensorData sensorData)
60
	{
61
		return true;
62
	}
63

    
64
	public bool GetMultiSourceFrame (KinectInterop.SensorData sensorData)
65
	{
66
		return false;
67
	}
68

    
69
	public void FreeMultiSourceFrame (KinectInterop.SensorData sensorData)
70
	{
71
	}
72

    
73
	public bool PollBodyFrame (KinectInterop.SensorData sensorData, ref KinectInterop.BodyFrameData bodyFrame, ref Matrix4x4 kinectToWorld, bool bIgnoreJointZ)
74
	{
75
		return false;
76
	}
77

    
78
	public bool PollColorFrame (KinectInterop.SensorData sensorData)
79
	{
80
		return false;
81
	}
82

    
83
	public bool PollDepthFrame (KinectInterop.SensorData sensorData)
84
	{
85
		return false;
86
	}
87

    
88
	public bool PollInfraredFrame (KinectInterop.SensorData sensorData)
89
	{
90
		return false;
91
	}
92

    
93
	public void FixJointOrientations (KinectInterop.SensorData sensorData, ref KinectInterop.BodyData bodyData)
94
	{
95
	}
96

    
97
	public bool IsBodyTurned (ref KinectInterop.BodyData bodyData)
98
	{
99
		return false;
100
	}
101

    
102
	public Vector2 MapSpacePointToDepthCoords (KinectInterop.SensorData sensorData, Vector3 spacePos)
103
	{
104
		return Vector2.zero;
105
	}
106

    
107
	public Vector3 MapDepthPointToSpaceCoords (KinectInterop.SensorData sensorData, Vector2 depthPos, ushort depthVal)
108
	{
109
		return Vector3.zero;
110
	}
111

    
112
	public bool MapDepthFrameToSpaceCoords (KinectInterop.SensorData sensorData, ref Vector3[] vSpaceCoords)
113
	{
114
		return false;
115
	}
116

    
117
	public Vector2 MapDepthPointToColorCoords (KinectInterop.SensorData sensorData, Vector2 depthPos, ushort depthVal)
118
	{
119
		return Vector2.zero;
120
	}
121

    
122
	public bool MapDepthFrameToColorCoords (KinectInterop.SensorData sensorData, ref Vector2[] vColorCoords)
123
	{
124
		return false;
125
	}
126

    
127
	public bool MapColorFrameToDepthCoords (KinectInterop.SensorData sensorData, ref Vector2[] vDepthCoords)
128
	{
129
		return false;
130
	}
131

    
132
	public int GetJointIndex (KinectInterop.JointType joint)
133
	{
134
		return (int)joint;
135
	}
136

    
137
	public KinectInterop.JointType GetParentJoint (KinectInterop.JointType joint)
138
	{
139
		switch(joint)
140
		{
141
		case KinectInterop.JointType.SpineBase:
142
			return KinectInterop.JointType.SpineBase;
143

    
144
		case KinectInterop.JointType.Neck:
145
			return KinectInterop.JointType.SpineShoulder;
146

    
147
		case KinectInterop.JointType.SpineShoulder:
148
			return KinectInterop.JointType.SpineMid;
149

    
150
		case KinectInterop.JointType.ShoulderLeft:
151
		case KinectInterop.JointType.ShoulderRight:
152
			return KinectInterop.JointType.SpineShoulder;
153

    
154
		case KinectInterop.JointType.HipLeft:
155
		case KinectInterop.JointType.HipRight:
156
			return KinectInterop.JointType.SpineBase;
157

    
158
		case KinectInterop.JointType.HandTipLeft:
159
			return KinectInterop.JointType.HandLeft;
160

    
161
		case KinectInterop.JointType.ThumbLeft:
162
			return KinectInterop.JointType.WristLeft;
163

    
164
		case KinectInterop.JointType.HandTipRight:
165
			return KinectInterop.JointType.HandRight;
166

    
167
		case KinectInterop.JointType.ThumbRight:
168
			return KinectInterop.JointType.WristRight;
169
		}
170

    
171
		return (KinectInterop.JointType)((int)joint - 1);
172
	}
173

    
174
	public KinectInterop.JointType GetNextJoint (KinectInterop.JointType joint)
175
	{
176
		switch(joint)
177
		{
178
		case KinectInterop.JointType.SpineBase:
179
			return KinectInterop.JointType.SpineMid;
180
		case KinectInterop.JointType.SpineMid:
181
			return KinectInterop.JointType.SpineShoulder;
182
		case KinectInterop.JointType.SpineShoulder:
183
			return KinectInterop.JointType.Neck;
184
		case KinectInterop.JointType.Neck:
185
			return KinectInterop.JointType.Head;
186

    
187
		case KinectInterop.JointType.ShoulderLeft:
188
			return KinectInterop.JointType.ElbowLeft;
189
		case KinectInterop.JointType.ElbowLeft:
190
			return KinectInterop.JointType.WristLeft;
191
		case KinectInterop.JointType.WristLeft:
192
			return KinectInterop.JointType.HandLeft;
193
		case KinectInterop.JointType.HandLeft:
194
			return KinectInterop.JointType.HandTipLeft;
195

    
196
		case KinectInterop.JointType.ShoulderRight:
197
			return KinectInterop.JointType.ElbowRight;
198
		case KinectInterop.JointType.ElbowRight:
199
			return KinectInterop.JointType.WristRight;
200
		case KinectInterop.JointType.WristRight:
201
			return KinectInterop.JointType.HandRight;
202
		case KinectInterop.JointType.HandRight:
203
			return KinectInterop.JointType.HandTipRight;
204

    
205
		case KinectInterop.JointType.HipLeft:
206
			return KinectInterop.JointType.KneeLeft;
207
		case KinectInterop.JointType.KneeLeft:
208
			return KinectInterop.JointType.AnkleLeft;
209
		case KinectInterop.JointType.AnkleLeft:
210
			return KinectInterop.JointType.FootLeft;
211

    
212
		case KinectInterop.JointType.HipRight:
213
			return KinectInterop.JointType.KneeRight;
214
		case KinectInterop.JointType.KneeRight:
215
			return KinectInterop.JointType.AnkleRight;
216
		case KinectInterop.JointType.AnkleRight:
217
			return KinectInterop.JointType.FootRight;
218
		}
219

    
220
		return joint;  // in case of end joint - Head, HandTipLeft, HandTipRight, FootLeft, FootRight
221
	}
222

    
223
	public bool IsFaceTrackingAvailable (ref bool bNeedRestart)
224
	{
225
		return false;
226
	}
227

    
228
	public bool InitFaceTracking (bool bUseFaceModel, bool bDrawFaceRect)
229
	{
230
		return false;
231
	}
232

    
233
	public void FinishFaceTracking ()
234
	{
235
	}
236

    
237
	public bool UpdateFaceTracking ()
238
	{
239
		return false;
240
	}
241

    
242
	public bool IsFaceTrackingActive ()
243
	{
244
		return false;
245
	}
246

    
247
	public bool IsDrawFaceRect ()
248
	{
249
		return false;
250
	}
251

    
252
	public bool IsFaceTracked (long userId)
253
	{
254
		return false;
255
	}
256

    
257
	public bool GetFaceRect (long userId, ref Rect faceRect)
258
	{
259
		return false;
260
	}
261

    
262
	public void VisualizeFaceTrackerOnColorTex (Texture2D texColor)
263
	{
264
	}
265

    
266
	public bool GetHeadPosition (long userId, ref Vector3 headPos)
267
	{
268
		return false;
269
	}
270

    
271
	public bool GetHeadRotation (long userId, ref Quaternion headRot)
272
	{
273
		return false;
274
	}
275

    
276
	public bool GetAnimUnits (long userId, ref System.Collections.Generic.Dictionary<KinectInterop.FaceShapeAnimations, float> afAU)
277
	{
278
		return false;
279
	}
280

    
281
	public bool GetShapeUnits (long userId, ref System.Collections.Generic.Dictionary<KinectInterop.FaceShapeDeformations, float> afSU)
282
	{
283
		return false;
284
	}
285

    
286
	public int GetFaceModelVerticesCount (long userId)
287
	{
288
		return 0;
289
	}
290

    
291
	public bool GetFaceModelVertices (long userId, ref Vector3[] avVertices)
292
	{
293
		return false;
294
	}
295

    
296
	public int GetFaceModelTrianglesCount ()
297
	{
298
		return 0;
299
	}
300

    
301
	public bool GetFaceModelTriangles (bool bMirrored, ref int[] avTriangles)
302
	{
303
		return false;
304
	}
305

    
306
	public bool IsSpeechRecognitionAvailable (ref bool bNeedRestart)
307
	{
308
		return false;
309
	}
310

    
311
	public int InitSpeechRecognition (string sRecoCriteria, bool bUseKinect, bool bAdaptationOff)
312
	{
313
		return -1;
314
	}
315

    
316
	public void FinishSpeechRecognition ()
317
	{
318
	}
319

    
320
	public int UpdateSpeechRecognition ()
321
	{
322
		return -1;
323
	}
324

    
325
	public int LoadSpeechGrammar (string sFileName, short iLangCode, bool bDynamic)
326
	{
327
		return -1;
328
	}
329

    
330
	public int AddGrammarPhrase (string sFromRule, string sToRule, string sPhrase, bool bClearRulePhrases, bool bCommitGrammar)
331
	{
332
		return -1;
333
	}
334

    
335
	public void SetSpeechConfidence (float fConfidence)
336
	{
337
	}
338

    
339
	public bool IsSpeechStarted ()
340
	{
341
		return false;
342
	}
343

    
344
	public bool IsSpeechEnded ()
345
	{
346
		return false;
347
	}
348

    
349
	public bool IsPhraseRecognized ()
350
	{
351
		return false;
352
	}
353

    
354
	public float GetPhraseConfidence ()
355
	{
356
		return 0f;
357
	}
358

    
359
	public string GetRecognizedPhraseTag ()
360
	{
361
		return string.Empty;
362
	}
363

    
364
	public void ClearRecognizedPhrase ()
365
	{
366
	}
367

    
368
	public bool IsBackgroundRemovalAvailable (ref bool bNeedRestart)
369
	{
370
		return false;
371
	}
372

    
373
	public bool InitBackgroundRemoval (KinectInterop.SensorData sensorData, bool isHiResPrefered)
374
	{
375
		return false;
376
	}
377

    
378
	public void FinishBackgroundRemoval (KinectInterop.SensorData sensorData)
379
	{
380
	}
381

    
382
	public bool UpdateBackgroundRemoval (KinectInterop.SensorData sensorData, bool isHiResPrefered, Color32 defaultColor, bool bAlphaTexOnly)
383
	{
384
		return false;
385
	}
386

    
387
	public bool IsBackgroundRemovalActive ()
388
	{
389
		return false;
390
	}
391

    
392
	public bool IsBRHiResSupported ()
393
	{
394
		return true;
395
	}
396

    
397
	public Rect GetForegroundFrameRect (KinectInterop.SensorData sensorData, bool isHiResPrefered)
398
	{
399
		return new Rect();
400
	}
401

    
402
	public int GetForegroundFrameLength (KinectInterop.SensorData sensorData, bool isHiResPrefered)
403
	{
404
		return 0;
405
	}
406

    
407
	public bool PollForegroundFrame (KinectInterop.SensorData sensorData, bool isHiResPrefered, Color32 defaultColor, bool bLimitedUsers, System.Collections.Generic.ICollection<int> alTrackedIndexes, ref byte[] foregroundImage)
408
	{
409
		return false;
410
	}
411

    
412
}