1
Kinect 깊이 카메라를 통해 단일 플레이어를 격리하려고합니다. 플레이어/깊이 정보를 처리하기 위해 NUI_IMAGE_TYPE_DEPTH_AND_PLAYER_INDEX
스트림을 여는 중입니다. 내가 선수를 그릴 사용하고 코드는 다음과 같습니다Kinect Depth 카메라에서 플레이어 분리
if (LockedRect.Pitch != 0) {
USHORT* curr = (USHORT*) LockedRect.pBits;
const USHORT* dataEnd = curr + ((width/2)*(height/2));
index = 0;
while (curr < dataEnd && playerId != 0) {
USHORT depth = *curr;
USHORT realDepth = NuiDepthPixelToDepth(depth);
BYTE intensity = 255;
USHORT player = NuiDepthPixelToPlayerIndex(depth);
// Only colour in the player
if (player == playerId) {
for (int i = index; i < index + 4; i++)
dest[i] = intensity;
}
else {
for (int i = index; i < index + 4; i++)
dest[i] = 0;
}
index += 4;
curr += 1;
}
}
dest
는 OpenGL을 텍스처입니다.
내가 겪고있는 문제는 두 번째 사람이 프레임에 들어가면 변수 player
이 변경되어 텍스처에 그려진 사람이 새로운 사람이되게하는 것입니다.