我对Kinect v2 CoordinateMapper API感到困惑。我想在Kinect v2中获取每个3D点的RGB值,即CameraSpacePoint。
请参阅下面的代码段:
var depthFrame = multiSourceFrame.DepthFrameReference.AcquireFrame();
var colorFrame = multiSourceFrame.ColorFrameReference.AcquireFrame();
var depthWidth = depthFrame.FrameDescription.Width;
var depthHeight = depthFrame.FrameDescription.Height;
ushort[] depthData = new ushort[depthWidth * depthHeight];
CameraSpacePoint[] camerapoints = new CameraSpacePoint[depthData.Length];
ColorSpacePoint[] colorpoints = new ColorSpacePoint[depthData.Length];
depthFrame.CopyFrameDataToArray(depthData);
this.coordinateMapper.MapDepthFrameToCameraSpace(depthData, camerapoints);
this.coordinateMapper.MapDepthFrameToColorSpace(depthData, colorpoints);
3D点存储在camerapoints
变量中。我想要每个camerapoints
的RGB值。换句话说,请参阅下面的pesudo代码:
RGBPoint[] rgbpoints = new RGBPoint[depthData.Length];
RGBPoint rgbpoint = rgbpoints[0];
int red = rgbpoint.r
int green = rgbpoint.g
int blue = rgbpoint.b
一如既往,非常感谢你。我非常感谢您的回应。
答案 0 :(得分:1)
android
数组包含与colorpoints
数组中每个像素对应的(x,y)索引。从这里开始,我们可以在depthData
指示的每个特定(x,y)索引处获取颜色框架数据(来自colorFrame
)。
colorpoints[index]