看起来他们显示的不是完整的点云,而是蓝色阴影强度图。这可以通过 Kinect for Windows sdk 中的深度图像来完成。您正在寻找的是玩家索引。这是深度图像的每个像素中提供的位。为了获得播放器索引位,您还必须在初始化代码中启用骨架流。
所以我会这样做。我正在修改此处找到的 Kinect for Windows SDK 快速入门之一,将其加载并进行以下更改:
//Change image type to BGRA32
image1.Source =
BitmapSource.Create(depthFrame.Width, depthFrame.Height,
96, 96, PixelFormats.Bgra32, null, pixels, stride);
//hardcoded locations to Blue, Green, Red, Alpha (BGRA) index positions
const int BlueIndex = 0;
const int GreenIndex = 1;
const int RedIndex = 2;
const int AlphaIndex = 3;
//get player and depth at pixel
int player = rawDepthData[depthIndex] & DepthImageFrame.PlayerIndexBitmask;
int depth = rawDepthData[depthIndex] >> DepthImageFrame.PlayerIndexBitmaskWidth;
//check each pixel for player, if player is blue intensity.
if (player > 0)
{
pixels[colorIndex + BlueIndex] = 255;
pixels[colorIndex + GreenIndex] = intensity;
pixels[colorIndex + RedIndex] = intensity;
pixels[colorIndex + AlphaIndex] = 100;
}
else
{
//if not player make black and transparent
pixels[colorIndex + BlueIndex] = 000;
pixels[colorIndex + GreenIndex] = 000;
pixels[colorIndex + RedIndex] = 000;
pixels[colorIndex + AlphaIndex] = 0;
}
我喜欢使用这个示例来测试颜色,因为它仍然为您提供右侧的深度查看器。我附上了下面运行的这种效果的图像:
左边的图像是带有轻微彩色像素级强度数据的强度图。
希望能帮助大卫·贝茨