IndexOutOfRange Exception while trying to get color values from Kinect v2 in C#
问题 I am trying to get the RGB values of each CameraSpacePoint in Kinect v2. While trying to access converted frame data, the code is throwing IndexOutOfRangeException . I found out that following lines are throwing this error: byte red = pixels[4 * pixelsBaseIndex + 0]; byte green = pixels[4 * pixelsBaseIndex + 1]; byte blue = pixels[4 * pixelsBaseIndex + 2]; byte alpha = pixels[4 * pixelsBaseIndex + 3]; Please see the complete code below: int depthWidth = kinectSensor.DepthFrameSource