Can*_*kel 7 signal-processing image-processing noise kinect
您好我正在尝试做一些图像处理.我使用Microsoft Kinect来检测房间里的人.我得到深度数据,做一些背景减法工作,最后得到一个像这样的视频序列当一个人进入场景并走动时:
我放了一个视频,以便您可以看到视频中噪音的行为.不同的颜色代表不同的深度.白色代表空.你可以看到它很嘈杂,尤其是红色噪音.
我需要尽可能地摆脱除人类以外的一切.当我进行侵蚀/扩张(使用非常大的窗口大小)时,我可以摆脱很多噪音,但我想知道是否还有其他方法可以使用.特别是视频中的红噪声很难通过侵蚀/扩张来消除.
一些说明:
1)如果我们知道场景中没有人,但我们所做的背景减法是完全自动的,即使场景中有人,甚至当相机移动等时,也可以进行更好的背景减法.这是我们现在可以得到的最好的背景减法.
2)该算法将在嵌入式系统上实时工作.因此,算法越有效,越容易.而且它不一定是完美的.虽然也欢迎复杂的信号处理技术(也许我们可能会在另一个不需要嵌入式实时处理的项目中使用它们).
3)我不需要实际的代码.只是想法.
假设您使用的是 Kinect SDK,这非常简单。我会按照这个视频了解深度基础知识,并执行以下操作:
private byte[] GenerateColoredBytes(DepthImageFrame depthFrame)
{
//get the raw data from kinect with the depth for every pixel
short[] rawDepthData = new short[depthFrame.PixelDataLength];
depthFrame.CopyPixelDataTo(rawDepthData);
//use depthFrame to create the image to display on-screen
//depthFrame contains color information for all pixels in image
//Height x Width x 4 (Red, Green, Blue, empty byte)
Byte[] pixels = new byte[depthFrame.Height * depthFrame.Width * 4];
//Bgr32 - Blue, Green, Red, empty byte
//Bgra32 - Blue, Green, Red, transparency
//You must set transparency for Bgra as .NET defaults a byte to 0 = fully transparent
//hardcoded locations to Blue, Green, Red (BGR) index positions
const int BlueIndex = 0;
const int GreenIndex = 1;
const int RedIndex = 2;
//loop through all distances
//pick a RGB color based on distance
for (int depthIndex = 0, colorIndex = 0;
depthIndex < rawDepthData.Length && colorIndex < pixels.Length;
depthIndex++, colorIndex += 4)
{
//get the player (requires skeleton tracking enabled for values)
int player = rawDepthData[depthIndex] & DepthImageFrame.PlayerIndexBitmask;
//gets the depth value
int depth = rawDepthData[depthIndex] >> DepthImageFrame.PlayerIndexBitmaskWidth;
//.9M or 2.95'
if (depth <= 900)
{
//we are very close
pixels[colorIndex + BlueIndex] = Colors.White.B;
pixels[colorIndex + GreenIndex] = Colors.White.G;
pixels[colorIndex + RedIndex] = Colors.White.R;
}
// .9M - 2M or 2.95' - 6.56'
else if (depth > 900 && depth < 2000)
{
//we are a bit further away
pixels[colorIndex + BlueIndex] = Colors.White.B;
pixels[colorIndex + GreenIndex] = Colors.White.G;
pixels[colorIndex + RedIndex] = Colors.White.R;
}
// 2M+ or 6.56'+
else if (depth > 2000)
{
//we are the farthest
pixels[colorIndex + BlueIndex] = Colors.White.B;
pixels[colorIndex + GreenIndex] = Colors.White.G;
pixels[colorIndex + RedIndex] = Colors.White.R;
}
////equal coloring for monochromatic histogram
//byte intensity = CalculateIntensityFromDepth(depth);
//pixels[colorIndex + BlueIndex] = intensity;
//pixels[colorIndex + GreenIndex] = intensity;
//pixels[colorIndex + RedIndex] = intensity;
//Color all players "gold"
if (player > 0)
{
pixels[colorIndex + BlueIndex] = Colors.Gold.B;
pixels[colorIndex + GreenIndex] = Colors.Gold.G;
pixels[colorIndex + RedIndex] = Colors.Gold.R;
}
}
return pixels;
}
Run Code Online (Sandbox Code Playgroud)
这使得除了人类以外的所有东西都变成白色,而人类变成金色。希望这可以帮助!
编辑
我知道你不一定想要代码只是想法,所以我会说找到一种算法来找到深度,以及找到人类数量的算法,并将除人类之外的所有东西都涂成白色。我已经提供了所有这些,但我不知道你是否知道发生了什么事。我还有最终程序的图像。

注意:我添加了第二个深度框架以进行透视