Reply To: Using SARndbox with libfreenect or Iannix

Home Forums AR Sandbox Forum Using SARndbox with libfreenect or Iannix Reply To: Using SARndbox with libfreenect or Iannix

Oliver Kreylos

To process an incoming depth image within the rawDepthFrameDispatcher method, or any method called by it, you access the frame contents via the getBuffer method:

const RawDepth* depthImage=static_cast<const RawDepth*>(frameBuffer.getBuffer());

RawDepth is a typedef for unsigned short, i.e., each pixel in the depth image is a 16-bit unsigned integer. You can get the size of the depth image from the frame buffer’s getSize() method, but for Kinect v1 the size is always 640×480.

The contents of the depth image are raw pattern displacement values, meaning they are not metric distances. The conversion formula from displacement values d to metric z values is slightly different for each Kinect camera; figuring out the parameters is part of intrinsic calibration. The precise formula to get z from d is:

float z = A / (B - float(d))

where A and B are intrinsic calibration parameters. Approximate values for A and B are 34000 and 1090, respectively, which will yield z values in centimeters.

There is also pretty significant non-linear distortion in the depth image, due to lens imperfections in both the IR pattern projector and the IR camera. My Kinect software uses per-pixel depth correction formulas to account for those; they are applied to the raw displacement values before conversion to metric distances. See the FrameFilter class’ filterThreadMethod method to see how they are applied.

Comments are closed.