我对 Kinect v2 CoordinateMapper API 感到困惑。我想在 Kinect v2中获取每个 3D 点(即CameraSpacePoint )的 RGB 值。
请看下面的代码片段:
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
变量中。我想要每个 RGB 值camerapoints
。换句话说,请看下面的伪代码:
RGBPoint[] rgbpoints = new RGBPoint[depthData.Length];
RGBPoint rgbpoint = rgbpoints[0];
int red = rgbpoint.r
int green = rgbpoint.g
int blue = rgbpoint.b
一如既往,非常感谢。我真的很感谢你的友好回应。