【发布时间】:2012-03-15 21:34:44
【问题描述】:
做一个小组项目,试图在玩家(特别是玩家)近/远时发生一些事情,所以我们编写了这个函数。 (我们不允许使用骨架特征)
private void FindDepth(DepthImageFrame depthFrame)
{
short[] rawDepthData = new short[depthFrame.PixelDataLength];
depthFrame.CopyPixelDataTo(rawDepthData);
Byte[] pixels = new byte[depthFrame.Height * depthFrame.Width * 4];
for (int depthIndex = 0; depthIndex < rawDepthData.Length; depthIndex++)
{
int player = rawDepthData[depthIndex] & DepthImageFrame.PlayerIndexBitmask;
int depth = rawDepthData[depthIndex] >> DepthImageFrame.PlayerIndexBitmaskWidth;
if (player > 0)
{
playerDepth = rawDepthData[depthIndex];
}
}
}
为什么这不能通过抓取一个像素来正确抓取玩家的深度?
【问题讨论】: