Kinect getting raw data and value

If you have a Kinect2, then you can use the library

import org.openkinect.freenect.*;
import org.openkinect.freenect2.*;
import org.openkinect.processing.*;
import org.openkinect.tests.*;

Kinect2 kinect2;

and then get the raw depth as a list of ints:

int[] rawDepth = kinect2.getRawDepth();

They can be accessed like a pixels[] array, using x, y:

int val = rawDepth[y * kinect.depthWidth + x]

For a recent related discussion, see: