JunkBox_Win_Lib 1.5.3
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
KinectDevice.cpp
Go to the documentation of this file.
1
2#include "WinBaseLib.h"
3#include "KinectDevice.h"
4#include "NiDevice.h"
5
6
7#ifdef ENABLE_KINECT_SDK
8
9using namespace jbxl;
10using namespace jbxwl;
11
12
14// Device
15
16CKinectDevice::CKinectDevice(void)
17{
18 context = NULL;
19
20 image = NULL;
21 depth = NULL;
22 skeleton = NULL;
23 face = NULL;
24
25 smoothParam = NULL;
26
27 m_count = 0;
28 m_state = NI_STATE_DETECT_STOPPED;
29 m_err_mesg = _T("");
30
31 m_xsize = 0;
32 m_ysize = 0;
33 m_nfps = 0;
34
35 clear_JointsData();
36}
37
38
39
40CKinectDevice::~CKinectDevice(void)
41{
42 DEBUG_INFO("DESTRUCTOR: CKinectDevice: START\n");
43 free();
44 DEBUG_INFO("DESTRUCTOR: CKinectDevice: END\n");
45}
46
47
48
49BOOL CKinectDevice::init(DWORD mode, BOOL use_image)
50{
51 //
52 HRESULT hrt = ::NuiGetSensorCount(&m_count);
53 if (FAILED(hrt) || m_count<=0) {
54 m_err_mesg = _T("CKinectDevice::init(): WARNING: No Kinect is detected.\n");
55 return FALSE;
56 }
57
58 BOOL ret = create_Context(mode);
59 if (ret && use_image) create_Image();
60 if (ret) ret = create_Depth();
61
62 if (ret) {
63 if (image!=NULL) {
64 m_xsize = image->m_xsize;
65 m_ysize = image->m_ysize;
66 m_nfps = image->m_nfps;
67 }
68 else if (depth!=NULL) {
69 m_xsize = depth->m_xsize;
70 m_ysize = depth->m_ysize;
71 m_nfps = depth->m_nfps;
72 }
73 else {
74 m_err_mesg = _T("CKinectDevice::init(): ERROR: Unknown Error is occurred!!");
75 ret = FALSE;
76 }
77 }
78
79 return ret;
80}
81
82
83
84void CKinectDevice::free(void)
85{
86 delete_Face();
87 delete_Depth();
88 delete_Image();
89 delete_Context();
90
91// free_Buffer(&m_err_mesg);
92}
93
94
95
96void CKinectDevice::clear_JointsData(void)
97{
98 memset(jointPosData, 0, sizeof(Vector4)*KINECT_JOINT_NUM);
99}
100
101
102
103
105// Create
106
107BOOL CKinectDevice::create_Context(DWORD mode, int index)
108{
109 HRESULT hrt = NuiCreateSensorByIndex(index, &context); // Now supports 1 kinect only
110 if (FAILED(hrt)) {
111 m_err_mesg = _T("CKinectDevice::create_Context(): ERROR: Fail to create Device.");
112 return FALSE;
113 }
114
115 hrt = context->NuiInitialize(mode);
116 if (FAILED(hrt)) {
117 delete_Context();
118 m_err_mesg = _T("CKinectDevice::create_Context(): ERROR: Fail to initalize Device.");
119 return FALSE;
120 }
121
122 return TRUE;
123}
124
125
126
127BOOL CKinectDevice::create_Image(void)
128{
129 NUI_IMAGE_RESOLUTION reso = NUI_IMAGE_RESOLUTION_640x480;
130 //NUI_IMAGE_RESOLUTION reso = NUI_IMAGE_RESOLUTION_320x240;
131
132 if (context==NULL) {
133 m_err_mesg = _T("CKinectDevice::create_Image(): ERROR: context is NULL.");
134 return FALSE;
135 }
136 if (image==NULL) image = new CKinectImage();
137
138 //
139 HANDLE hdl = image->create(TRUE, FALSE, NULL);
140 if (hdl==NULL) {
141 delete_Image();
142 m_err_mesg = _T("CKinectDevice::create_Image(): ERROR: Fail to create Image.");
143 return FALSE;
144 }
145
146 HRESULT hrt = context->NuiImageStreamOpen(NUI_IMAGE_TYPE_COLOR, reso, NULL, 2, image->m_handle, &image->m_stream);
147 if (FAILED(hrt)) {
148 delete_Image();
149 m_err_mesg = _T("CKinectDevice::create_Image(): ERROR: Fail to open stream of Image.");
150 return FALSE;
151 }
152
153 NuiImageResolutionToSize(reso, (DWORD&)image->m_xsize, (DWORD&)image->m_ysize);
154 image->m_nfps = 30;
155
156 if (image->m_data==NULL) image->make_data(); // 4byte/pixcel
157
158 return TRUE;
159}
160
161
162
163BOOL CKinectDevice::create_Depth(void)
164{
165 NUI_IMAGE_RESOLUTION reso = NUI_IMAGE_RESOLUTION_640x480;
166 //NUI_IMAGE_RESOLUTION reso = NUI_IMAGE_RESOLUTION_320x240;
167
168 if (context==NULL) {
169 m_err_mesg = _T("CKinectDevice::create_Depth(): ERROR: context is NULL.");
170 return FALSE;
171 }
172 if (depth==NULL) depth = new CKinectDepth();
173
174 //
175 HANDLE hdl = depth->create(TRUE, FALSE, NULL);
176 if (hdl==NULL) {
177 delete_Depth();
178 m_err_mesg = _T("CKinectDevice::create_Depth(): ERROR: Fail to create Depth.");
179 return FALSE;
180 }
181
182 HRESULT hrt = context->NuiImageStreamOpen(NUI_IMAGE_TYPE_DEPTH_AND_PLAYER_INDEX, reso, NULL, 2, depth->m_handle, &depth->m_stream);
183 if (FAILED(hrt)) {
184 delete_Depth();
185 m_err_mesg = _T("CKinectDevice::create_Depth(): ERROR: Fail to open stream of Depth.");
186 return FALSE;
187 }
188
189 //
190 NuiImageResolutionToSize(reso, (DWORD&)depth->m_xsize, (DWORD&)depth->m_ysize);
191 depth->m_nfps = 30;
192
193 if (depth->m_data==NULL) depth->make_data(); // 2byte/pixcel
194// if (!depth->has_map) depth->make_map();
195
196 return TRUE;
197}
198
199
200
201BOOL CKinectDevice::create_Skeleton(int profile)
202{
203 if (context==NULL) {
204 m_err_mesg = _T("CKinectDevice::create_Skeleton(): ERROR: context is NULL.");
205 return FALSE;
206 }
207 if (depth==NULL) {
208 m_err_mesg = _T("CKinectDevice::create_Skeleton(): ERROR: depth is NULL.");
209 return FALSE;
210 }
211 if (skeleton==NULL) skeleton = new CKinectSkeleton();
212
213 //
214 HANDLE hdl = skeleton->create(TRUE, FALSE, NULL);
215 if (hdl==NULL) {
216 delete_Skeleton();
217 m_err_mesg = _T("CKinectDevice::create_Skeleton(): ERROR: Fail to create Skeleton.");
218 return FALSE;
219 }
220
221 //
222 HRESULT hrt;
223 DWORD ftracking = 0;
224 DWORD streamode = 0;
225 if (profile==KINECT_SKEL_PROFILE_UPPER) {
226 ftracking = NUI_SKELETON_TRACKING_FLAG_ENABLE_SEATED_SUPPORT;
227 ftracking |= NUI_SKELETON_TRACKING_FLAG_ENABLE_IN_NEAR_RANGE;
228 streamode = NUI_IMAGE_STREAM_FLAG_ENABLE_NEAR_MODE;
229 }
230
231 // for Near mode
232 hrt = context->NuiImageStreamSetImageFrameFlags(depth->m_stream, streamode);
233 if (SUCCEEDED(hrt)) {
234 if (profile==KINECT_SKEL_PROFILE_UPPER) depth->correct_map(-15, 8);
235 }
236
237 //
238 hrt = context->NuiSkeletonTrackingEnable(skeleton->m_handle, ftracking);
239 if (FAILED(hrt)) {
240 delete_Skeleton();
241 m_err_mesg = _T("CKinectDevice::create_Skeleton(): ERROR: Fail to enable Skeleton Tracking.");
242 return FALSE;
243 }
244
245 return TRUE;
246}
247
248
249
250BOOL CKinectDevice::create_Face(void)
251{
252 if (context==NULL) {
253 m_err_mesg = _T("CKinectDevice::create_Face(): ERROR: context is NULL.");
254 return FALSE;
255 }
256 if (image==NULL) {
257 m_err_mesg = _T("CKinectDevice::create_Face(): ERROR: image is NULL.");
258 return FALSE;
259 }
260 if (depth==NULL) {
261 m_err_mesg = _T("CKinectDevice::create_Face(): ERROR: depth is NULL.");
262 return FALSE;
263 }
264
265 if (face==NULL) face = new CKinectFaceTracker();
266
267 BOOL ret = face->create(image->m_xsize, image->m_ysize, image->m_data, depth->m_data);
268 if (!ret) {
269 delete_Face();
270 m_err_mesg = _T("CKinectDevice::create_Face(): ERROR: Fail to create Face Tracker\nMaybe FaceTrackData.dll is not found.");
271 }
272
273 return ret;
274}
275
276
277
278
280// Wait Event
281
282BOOL CKinectDevice::wait_Image(DWORD msec)
283{
284 if (image==NULL) return FALSE;
285 if (image->m_data==NULL) return FALSE;
286
287 BOOL ret = image->wait(msec);
288 if (ret) {
289 HRESULT hrt = context->NuiImageStreamGetNextFrame(image->m_stream, 0, &imageFrame); // 0 msec wait
290 if (FAILED(hrt)) return FALSE;
291 //
292 NUI_LOCKED_RECT rect;
293 imageFrame.pFrameTexture->LockRect(0, &rect, NULL, 0);
294 long int len = rect.Pitch*image->m_ysize;
295
296 memcpy(image->m_data, (char*)rect.pBits, len);
297 imageFrame.pFrameTexture->UnlockRect(0);
298 context->NuiImageStreamReleaseFrame(image->m_stream, &imageFrame);
299 }
300
301 return ret;
302}
303
304
305
306BOOL CKinectDevice::wait_Depth(DWORD msec)
307{
308 if (depth==NULL) return FALSE;
309 if (depth->m_data==NULL) return FALSE;
310
311 BOOL ret = depth->wait(msec);
312 if (ret) {
313 HRESULT hrt = context->NuiImageStreamGetNextFrame(depth->m_stream, 0, &depthFrame);
314 if (FAILED(hrt)) return FALSE;
315
316 //
317 NUI_LOCKED_RECT rect;
318 depthFrame.pFrameTexture->LockRect(0, &rect, NULL, 0);
319 long int len = rect.Pitch*depth->m_ysize;
320
321 memcpy(depth->m_data, (char*)rect.pBits, len);
322 depthFrame.pFrameTexture->UnlockRect(0);
323 context->NuiImageStreamReleaseFrame(depth->m_stream, &depthFrame);
324 }
325
326 return ret;
327}
328
329
330
331int CKinectDevice::wait_Skeleton(int tuser, int duser, DWORD msec)
332{
333 if (skeleton==NULL) return 0;
334
335 BOOL ret = skeleton->wait(msec);
336 if (ret) {
337 HRESULT hrt = context->NuiSkeletonGetNextFrame(0, &skltnFrame);
338 if (smoothParam!=NULL && !FAILED(hrt)) {
339 hrt = context->NuiTransformSmooth(&skltnFrame, smoothParam);
340 }
341 if (FAILED(hrt)) return FALSE;
342
343 //
344 if (tuser>0) {
345 skeleton->m_data = skltnFrame.SkeletonData[tuser-1];
346 if (skeleton->m_data.eTrackingState!=NUI_SKELETON_TRACKED) {
347 tuser = 0;
348 }
349 }
350 if (tuser==0) {
351 tuser = get_TrackingUser(duser);
352 }
353 if (tuser==0) return 0;
354
355 //
356 for (int j=0; j<KINECT_JOINT_NUM; j++) {
357 jointPosData[j] = skeleton->m_data.SkeletonPositions[j];
358 }
359 }
360 else tuser = 0;
361
362 return tuser;
363}
364
365
366
367
369// Detection
370
371BOOL CKinectDevice::start_Detection(int profile)
372{
373 BOOL ret = FALSE;
374 if (m_state==NI_STATE_DETECT_EXEC) {
375 m_err_mesg = _T("CKinectDevice::start_Detection(): WARNING: detection is already executed.");
376 return ret;
377 }
378
379 m_state = NI_STATE_DETECT_STARTING;
380 clear_JointsData();
381
382 if (depth==NULL) create_Depth();
383 depth->make_map();
384
385 ret = create_Skeleton(profile);
386 if (ret) {
387 m_state = NI_STATE_DETECT_EXEC;
388 }
389 else {
390 m_state = NI_STATE_DETECT_STOPPING;
391 delete_Skeleton();
392 m_state = NI_STATE_DETECT_STOPPED;
393 }
394
395 //
396 if (ret) {
397 BOOL infoff = context->NuiGetForceInfraredEmitterOff();
398 if (infoff) ret = !context->NuiSetForceInfraredEmitterOff(FALSE);
399 if (!ret) m_err_mesg = _T("CKinectDevice::start_Detection(): ERROR: Fail to Start Emitter.");
400 }
401
402 return ret;
403}
404
405
406
407BOOL CKinectDevice::stop_Detection(void)
408{
409 if (m_state==NI_STATE_DETECT_STOPPED) {
410 m_err_mesg = _T("CKinectDevice::stop_Detection(): WARNING: detection is already stopped.");
411 return FALSE;
412 }
413
414 m_state= NI_STATE_DETECT_STOPPING;
415 context->NuiSetForceInfraredEmitterOff(TRUE);
416
417 ::Sleep(NI_STOP_WAIT_TIME);
418 depth->delete_map();
419 delete_Skeleton();
420
421 m_state = NI_STATE_DETECT_STOPPED;
422
423 return TRUE;
424}
425
426
427
428int CKinectDevice::get_TrackingUser(int duser)
429{
430 int ret = 0;
431
432 if (depth!=NULL && skeleton!=NULL) {
433 depth->get_users();
434 for (int i=0; i<KINECT_USERS_NUM; i++) {
435 int idx = (duser + i) % KINECT_USERS_NUM;
436 if (depth->userLabel[idx]>0) {
437 skeleton->m_data = skltnFrame.SkeletonData[idx];
438 if (skeleton->m_data.eTrackingState==NUI_SKELETON_TRACKED) {
439 ret = idx + 1;
440 break;
441 }
442 }
443 }
444 }
445
446 return ret;
447}
448
449
450
451
453// Delete
454
455void CKinectDevice::delete_Context(void)
456{
457 if (context!=NULL) {
458 context->Release();
459 context->NuiShutdown();
460 context = NULL;
461 }
462 return;
463}
464
465
466
467void CKinectDevice::delete_Image(void)
468{
469 if (image!=NULL) {
470 delete(image);
471 image = NULL;
472 }
473 return;
474}
475
476
477
478void CKinectDevice::delete_Depth(void)
479{
480 if (depth!=NULL) {
481 delete(depth);
482 depth = NULL;
483 }
484 return;
485}
486
487
488
489void CKinectDevice::delete_Skeleton(void)
490{
491 if (skeleton!=NULL) {
492 if (context!=NULL) {
493 context->NuiSkeletonTrackingDisable();
494 }
495 delete(skeleton);
496 skeleton = NULL;
497 }
498 return;
499}
500
501
502
503void CKinectDevice::delete_Face(void)
504{
505 if (face!=NULL) {
506 delete(face);
507 face = NULL;
508 }
509 return;
510}
511
512
513
514
516// Image クラス
517
518CKinectImage::CKinectImage(void)
519{
520 m_data = NULL;
521 m_data_len = 0;
522
523 m_stream = NULL;
524
525 m_xsize = 0;
526 m_ysize = 0;
527 m_nfps = 0;
528}
529
530
531
532void CKinectImage::free(void)
533{
534 if (m_data!=NULL) {
535 ::free(m_data);
536 m_data = NULL;
537 m_data_len = 0;
538 }
539 return;
540}
541
542
543
544void CKinectImage::make_data(void)
545{
546 if (m_xsize<=0 || m_ysize<=0) return;
547
548 m_data_len = m_xsize*m_ysize*4; // 4Byte/pixcel
549 m_data = (uByte*)malloc(m_data_len);
550
551 return;
552}
553
554
555
556
558// Depth クラス
559
560CKinectDepth::CKinectDepth(void)
561{
562 m_data = NULL;
563 m_data_len = 0;
564
565 has_map = FALSE;
566 m_xmap_i2d = NULL;
567 m_ymap_i2d = NULL;
568 m_xmap_d2i = NULL;
569 m_ymap_d2i = NULL;
570 m_map_len = 0;
571
572 m_stream = NULL;
573
574 m_xsize = 0;
575 m_ysize = 0;
576 m_nfps = 0;
577}
578
579
580
581void CKinectDepth::free(void)
582{
583 if (m_data!=NULL) {
584 ::free(m_data);
585 m_data = NULL;
586 m_data_len = 0;
587 }
588
589 delete_map();
590
591 return;
592}
593
594
595
596void CKinectDepth::make_data(void)
597{
598 if (m_xsize<=0 || m_ysize<=0) return;
599
600 m_data_len = m_xsize*m_ysize*2; // 2Byte/pixcel
601 m_data = (uByte*)malloc(m_data_len);
602
603 return;
604}
605
606
607
608void CKinectDepth::make_map(void)
609{
610 if (m_xsize<=0 || m_ysize<=0) return;
611 if (has_map) delete_map();
612
613 int sz = m_xsize*m_ysize;
614 int len = sizeof(int)*sz;
615
616 m_xmap_i2d = (int*)malloc(len);
617 m_ymap_i2d = (int*)malloc(len);
618 m_xmap_d2i = (int*)malloc(len);
619 m_ymap_d2i = (int*)malloc(len);
620
621 if (m_xmap_i2d==NULL || m_ymap_i2d==NULL || m_xmap_d2i==NULL || m_ymap_d2i==NULL) {
622 if (m_xmap_i2d!=NULL) { ::free(m_xmap_i2d); m_xmap_i2d = NULL;}
623 if (m_ymap_i2d!=NULL) { ::free(m_ymap_i2d); m_ymap_i2d = NULL;}
624 if (m_xmap_d2i!=NULL) { ::free(m_xmap_d2i); m_xmap_d2i = NULL;}
625 if (m_ymap_d2i!=NULL) { ::free(m_ymap_d2i); m_ymap_d2i = NULL;}
626 return;
627 }
628
629 memset(m_xmap_i2d, 0, len);
630 memset(m_ymap_i2d, 0, len);
631 memset(m_xmap_d2i, 0, len);
632 memset(m_ymap_d2i, 0, len);
633
634 long int ii, jj, kk;
635 for (int j=0; j<m_ysize; j++) {
636 for (int i=0; i<m_xsize; i++) {
637 // Depth is NUI_IMAGE_RESOLUTION_320x240
638 //HRESULT hdr = NuiImageGetColorPixelCoordinatesFromDepthPixel(NUI_IMAGE_RESOLUTION_640x480, NULL, i, j, 0, &ii, &jj);
639 //ii = ii/2;
640 //jj = jj/2;
641
642 // Depth is NUI_IMAGE_RESOLUTION_640x480
643 HRESULT hdr = NuiImageGetColorPixelCoordinatesFromDepthPixelAtResolution
644 (NUI_IMAGE_RESOLUTION_640x480, NUI_IMAGE_RESOLUTION_640x480, NULL, (LONG)i, (LONG)j, 0, &ii, &jj);
645 //
646 if (ii>=0 && ii<m_xsize && jj>=0 && jj<m_ysize) {
647 kk = jj*m_xsize + ii;
648 m_xmap_i2d[kk] = (int)(i + 1);
649 m_ymap_i2d[kk] = (int)(j + 1);
650 }
651 kk = j*m_xsize + i;
652 m_xmap_d2i[kk] = ii;
653 m_ymap_d2i[kk] = jj;
654 }
655 }
656
657 // -1 is no data
658 for (int i=0; i<sz; i++) {
659 m_xmap_i2d[i]--;
660 m_ymap_i2d[i]--;
661 if (m_xmap_i2d[i]<0 || m_ymap_i2d[i]<0) {
662 m_xmap_i2d[i] = m_ymap_i2d[i] = -1;
663 }
664 }
665
666 m_map_len = sz;
667 has_map = TRUE;
668
669 return;
670}
671
672
673
674void CKinectDepth::delete_map(void)
675{
676 if (m_xmap_i2d!=NULL) {
677 ::free(m_xmap_i2d);
678 m_xmap_i2d = NULL;
679 }
680 if (m_ymap_i2d!=NULL) {
681 ::free(m_ymap_i2d);
682 m_ymap_i2d = NULL;
683 }
684 if (m_xmap_d2i!=NULL) {
685 ::free(m_xmap_d2i);
686 m_xmap_d2i = NULL;
687 }
688 if (m_ymap_d2i!=NULL) {
689 ::free(m_ymap_d2i);
690 m_ymap_d2i = NULL;
691 }
692
693 m_map_len = 0;
694 has_map = FALSE;
695
696 return;
697}
698
699
700
701void CKinectDepth::correct_map(int cx, int cy)
702{
703 if (!has_map) make_map();
704 if (!has_map) return;
705
706 // Correct Map
707 if (cx!=0 || cy!=0) {
708 int sz = m_xsize*m_ysize;
709 int i2d_x, i2d_y, d2i_x, d2i_y;
710
711 for (int i=0; i<sz; i++) {
712 if (m_xmap_i2d[i]>=0) {
713 i2d_x = m_xmap_i2d[i] + cx;
714 i2d_y = m_ymap_i2d[i] + cy;
715 if (i2d_x>=0 && i2d_x<m_xsize) m_xmap_i2d[i] = i2d_x;
716 if (i2d_y>=0 && i2d_y<m_ysize) m_ymap_i2d[i] = i2d_y;
717 }
718 //
719 d2i_x = m_xmap_d2i[i] - cx;
720 d2i_y = m_ymap_d2i[i] - cy;
721 if (d2i_x>=0 && d2i_x<m_xsize) m_xmap_d2i[i] = d2i_x;
722 if (d2i_y>=0 && d2i_y<m_ysize) m_ymap_d2i[i] = d2i_y;
723 }
724 }
725
726 return;
727}
728
729
730
731int CKinectDepth::get_user_index(int i, int j)
732{
733 int val = 0;
734 if (i<0 || j<0 || i>=m_xsize || j>=m_ysize) return val;
735
736 if (has_map) {
737 int len = j*m_xsize + i;
738 int ii = m_xmap_i2d[len];
739 int jj = m_ymap_i2d[len];
740 if (ii>=0 && jj>=0 && ii<m_xsize && jj<m_ysize) {
741 val = m_data[(jj*m_xsize + ii)*2] & 0x07;
742 }
743 }
744 else {
745 val = m_data[(j*m_xsize + i)*2] & 0x07;
746 }
747
748 if (val>KINECT_USERS_NUM) val = 0;
749
750 return val;
751}
752
753
754
755uWord CKinectDepth::get_depth(int i, int j)
756{
757 uWord val = 0;
758 if (i<0 || j<0 || i>=m_xsize || j>=m_ysize) return val;
759
760 uWord* ptr = (uWord*)m_data;
761 if (has_map) {
762 int len = j*m_xsize + i;
763 int ii = m_xmap_i2d[len];
764 int jj = m_xmap_i2d[len];
765 if (ii>=0 && jj>=0) {
766 val = ::NuiDepthPixelToDepth(ptr[jj*m_xsize+ii]);
767 }
768 else {
769 val = ::NuiDepthPixelToDepth(ptr[j*m_xsize+i]);
770 }
771 }
772 else {
773 val = ::NuiDepthPixelToDepth(ptr[j*m_xsize+i]);
774 }
775
776 return val;
777}
778
779
780
781void CKinectDepth::get_users(void)
782{
783 memset(userLabel, 0, KINECT_USERS_NUM*sizeof(int));
784
785 for (int j=0; j<m_ysize; j++) {
786 int lj = j*m_xsize;
787 for (int i=0; i<m_xsize; i++) {
788 int val = m_data[(lj + i)*2] & 0x07;
789 if (val>0 && val<=KINECT_USERS_NUM) {
790 userLabel[val-1]++;
791 }
792 }
793 }
794
795 return;
796}
797
798
799
800void CKinectDepth::get_image_coord(int* i, int* j)
801{
802 if (i==NULL || j==NULL) return;
803 if ((*i)<0 || (*j)<0 || (*i)>=m_xsize || (*j)>=m_ysize) {
804 *i = *j = -1;
805 return;
806 }
807
808 if (has_map) {
809 int len = (*j)*m_xsize + (*i);
810 *i = m_xmap_d2i[len];
811 *j = m_ymap_d2i[len];
812 }
813
814 return;
815}
816
817
818
819
821// Skeleton クラス
822
823CKinectSkeleton::CKinectSkeleton(void)
824{
825 m_stream = NULL;
826}
827
828
829
830void CKinectSkeleton::free(void)
831{
832 return;
833}
834
835#endif // ENABLE_KINECT_SDK
836