在Kinect深度相机中隔离玩家
Isolating Player in Kinect Depth Camera
我试图通过Kinect深度摄像头隔离单个玩家。我打开一个NUI_IMAGE_TYPE_DEPTH_AND_PLAYER_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;
}
}
dest
是OpenGL纹理。
我遇到的问题是,当第二个人进入帧时,变量player
会发生变化,并导致纹理中绘制的人成为新人。
好了,我知道怎么做了。
我需要获得骨骼ID(0到5),它映射到深度像素用户(1到6)。所以当传感器发现骨骼时,它保存ID,并将其设置为playerId。PlayerId只有在关联骨架被传感器丢失时才会被清除。
相关文章:
- 带内存和隔离功能的SQLite
- 使用不同的CRT将新的C++代码与旧的(二进制)组件隔离开来的最佳方法是什么
- 如何使用隔离>终止执行来停止所有线程
- 从矢量中删除元素后出现隔离错误
- 根据用户回答声明"Players"。用户选择玩家数量。播放器是结构体
- 玩家加速穿越世界(C++)
- 在 gtest 中初始化堆栈上的引用变量的隔离错误
- C++:如何根据地形高度更新玩家身高?
- 预测玩家输赢,博弈论问题
- 线程时访问静态映射时出现隔离错误
- C++对玩家进行排序
- 比特币隔离见证钱包地址计算
- 并行快速排序分区中的隔离错误
- C++ 如何处理所有可能的玩家移动输入?
- C++多线程程序:变量定义为类成员的隔离错误
- 玩家中的%是什么意思=(玩家%2)?1:2;
- 为什么玩家控制器"own"偏航俯仰和滚动,但角色"owns"它的位置?
- TFLite 隔离错误,通过获取C++输入和输出
- 我只是在寻找模板,在我的书中找到了这段代码,这显示了隔离错误?
- 在Kinect深度相机中隔离玩家