나는 키 넥트 API를 실험하고, 그리고 무엇을 달성하려는 (그리고 실패)하고하면 다음과 같다 :넥트는 깊이 데이터에 해골 데이터로 변환하고 다시
오프 시작 나는 키 넥트에서 골격의 데이터를 얻을 수 및
mRightHandPosition = skeletonFrame.SkeletonData[i].SkeletonPositions[NUI_SKELETON_POSITION_HAND_RIGHT];
distance = sqrt(pow(mRightHandPosition.x, 2) + pow(mRightHandPosition.y, 2) + pow(mRightHandPosition.z, 2));
I는 (깊이/컬러)의 손의 위치를 얻기 위해, 깊이 데이터에 오른손의 골격 데이터 변환 넥트에서 사용자의 오른손의 거리 alculate 영상.
FLOAT curRightX = 0, curRightY = 0;
Vector4 pixelInSkeletonSpace;
NuiTransformSkeletonToDepthImage(mRightHandPosition, &curRightX, &curRightY, cDepthResolution);
은 손의 화소 위치를 획득 한 난 골격 데이터로 픽셀을 다시 변환하고 넥트에서 픽셀 (손), 다시 물체의 거리를 산출 할. 그 일을하는 것은 이전과 거의 같은 거리를 제공해야한다고 생각 하겠지만 (물론 약간의 오류는 있지만) 그렇지 않습니다. 다음은 내가하는 일입니다.
//the position of the depth pixel in the mLockedRect.pBits array
//i have set the depth sensor resolution to 320x240
int pixelPosition = 2 * ((int)curRightX + (int)curRightY * 320);
USHORT p;
//convert the two consecutive bytes to USHORT
p = (((unsigned short)mLockedRect.pBits[pixelPosition]) << 8) | mLockedRect.pBits[pixelPosition + 1];
//get the pixel in skeleton space
pixelInSkeletonSpace = NuiTransformDepthImageToSkeleton(LONG(curRightX), LONG(curRightY), p, cDepthResolution);
//calculate again the distance (which turns out completely wrong)
distance = sqrt(pow(pixelInSkeletonSpace.x, 2) + pow(pixelInSkeletonSpace.y, 2) + pow(pixelInSkeletonSpace.z, 2));
제가 분명한 사실을 놓치고 있습니까? 내가 잘못 알아 발견 검색을 많이 후 사전