I am getting confused with the Kinect v2 CoordinateMapper API. I want to get RGB values of each 3D point aka CameraSpacePoint in Kinect v2.
Please see below the code snippet:
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);
The 3D points are stored in camerapoints
variable. I want to the RGB values of each camerapoints
. In other words, please see below pesudo code:
RGBPoint[] rgbpoints = new RGBPoint[depthData.Length];
RGBPoint rgbpoint = rgbpoints[0];
int red = rgbpoint.r
int green = rgbpoint.g
int blue = rgbpoint.b
As always, thank you very much. I really appreciate your kind response.