正如我们所知,在Kinect V2中,深度和颜色分辨率是不同的。使用SDK中提供的映射API,可以很容易地从颜色框中获取颜色值,并将其放入深度框中,如互联网上的许多帖子所示。这将得到大小为512x414的最终图像。
但我想提取原始彩色帧中的播放器/用户,以便最终图像的分辨率为1920x1080。
我可以考虑使用映射API,并使用用户/播放器像素标记颜色帧。然后应用一些启发式方法,曝光RGB值的相邻像素,完成用户/播放器图像。
对于如何最好地做到这一点,有没有人有更好的建议?
发布于 2015-09-04 17:13:56
您好,不是从深度映射到颜色,而是尝试将您的颜色框架映射到深度空间,并将输出图像的大小设置为等于彩色图像的大小。
coordinateMapper.MapColorFrameToDepthSpace(depthData, depthPoints);
for (int colorIndex = 0; colorIndex < depthPoints.Length; ++colorIndex)
            {
                DepthSpacePoint depthPoint = depthPoints[colorIndex];
                if (!float.IsNegativeInfinity(depthPoint.X) && !float.IsNegativeInfinity(depthPoint.Y))
                {
                    int depthX = (int)(depthPoint.X + 0.5f);
                    int depthY = (int)(depthPoint.Y + 0.5f);
                    if ((depthX >= 0) && (depthX < depthWidth) && (depthY >= 0) && (depthY < depthHeight))
                    {
                        int depthIndex = (depthY * depthWidth) + depthX;
                        byte player = bodyData[depthIndex];
                        if (player != 0xff)
                        {
                            int sourceIndex = colorIndex * 4;
                            OutImage[sourceIndex] = _colorData[sourceIndex++];    
                            OutImage[sourceIndex] = _colorData[sourceIndex++];    
                            OutImage[sourceIndex] = _colorData[sourceIndex++];    
                            OutImage[sourceIndex] = 0xff;                         
                        }
                    }
                }
            }Init for output Image:
 OutImage= new byte[colorWidth*colorHeight*4]; //1920x1080x4https://stackoverflow.com/questions/24903485
复制相似问题