C++ Kinect深度摄像头中的隔离播放器
我正试图通过Kinect深度摄像头隔离一个玩家。我正在打开一个C++ Kinect深度摄像头中的隔离播放器,c++,kinect,C++,Kinect,我正试图通过Kinect深度摄像头隔离一个玩家。我正在打开一个NUI\u IMAGE\u TYPE\u DEPTH\u和\u PLAYER\u INDEX流来处理播放器/深度信息。我用来画玩家的代码是: if (LockedRect.Pitch != 0 ) { USHORT* curr = (USHORT*) LockedRect.pBits; const USHORT* dataEnd = curr + ((width/2)*(height/2)); in
NUI\u IMAGE\u TYPE\u DEPTH\u和\u PLAYER\u INDEX
流来处理播放器/深度信息。我用来画玩家的代码是:
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;
}
}
if(LockedRect.Pitch!=0){
USHORT*curr=(USHORT*)LockedRect.pBits;
const USHORT*dataEnd=curr+((宽度/2)*(高度/2));
指数=0;
while(curr
dest
是一种OpenGL纹理
我遇到的问题是,当第二个人进入帧时,变量
player
会发生变化,并导致在纹理中绘制的人成为新的人。好的,我知道了怎么做
我需要得到骨骼ID(0到5),它映射到深度像素用户(1到6)。因此,当传感器发现骨架时,它保存了ID,并将其设置为playerId。PlayerId只有在其相关骨架被传感器丢失时才会被清除。好的,我知道怎么做了 我需要得到骨骼ID(0到5),它映射到深度像素用户(1到6)。因此,当传感器发现骨架时,它保存了ID,并将其设置为playerId。PlayerId仅在其相关骨架被传感器丢失时才被清除