Getting raw 11bit array from kinect


According to the Documentation ofKinect the method getRawDepthPixelsRef ( should return the reference to the 11bit Raw data from the kinect, but instead it contains the distance in millimeters, which according to the doc’s the function getDistancePixelsRef should return.

looking at the ofKinect code shows that getDistanceAt() and getWorldCoordinateAt() rely both on depthPixelsRaw, which is returned when calling getRawDepthPixelsRef():

    unsigned short * ofxKinect::getRawDepthPixelsRef() {
    	return depthPixelsRaw;

    float ofxKinect::getDistanceAt(int x, int y) {
    	return depthPixelsRaw[y * width + x];

float ofxKinect::getDistanceAt(const ofPoint & p) {
	return getDistanceAt(p.x, p.y);

ofVec3f ofxKinect::getWorldCoordinateAt(int x, int y) {
	return getWorldCoordinateAt(x, y, getDistanceAt(x, y));

ofVec3f ofxKinect::getWorldCoordinateAt(float cx, float cy, float wz) {
	double wx, wy;
	freenect_camera_to_world(kinectDevice, cx, cy, wz, &wx, &wy);
	return ofVec3f(wx, wy, wz);

how can I get my hands on the 11bit Raw Data?

PS. By the way, I like this new forum interface!

Hi, getRawDepthPixelsRef will give you the raw depth. the 11 bits are represented using an unsigned short (16 bits). If you check ofxKinect’s code you’ll realize how the kinect data is passed to depthPixelsRaw image.

Hi. Maybe I am under the spell of a missunderstanding: I expect the 11bits raw depth (stored in an unsigned short array) represent a kinect-internal-nonmetric distance in the range between 0 and 2047, but when I look at the data, they are very definitly in millimeters. (between ca. 500…6000). But I would like to play with the 11bits raw depth.

Hi you’re right.
You’ll need to modify ofxKinect to allow you to get the depths as raw 11 bit.
in ofxKinect.cpp
inside threadedFunction() look for the following line

freenect_frame_mode depthMode = freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, bUseRegistration?FREENECT_DEPTH_REGISTERED:FREENECT_DEPTH_MM);


That works at least for me.

Let me knwo how it goes.