Get Kinected to your CNC!

Is it really possible to get decent CNC ready 3D data our of a $150 game interface? Well, lets find out...

The Xbox Kinect from Microsoft is a cool bit of kit intended to be plugged into an Xbox360 to allow interaction with games via gestures and body movement. However there are a couple of things about it that caught our eye...

Firstly, it comes with a standard USB adapter, originally intended to allow it to be used with older Xboxes, which allows it to be connected to a standard PC. Secondly, the gesture technology relies on a 3D scan of the environment in front of the Kinect using an infrared pattern - would this 3D scan be good enough for us to create 3D models with enough detail to cut using a CNC machine?

The three sensors we were interested in were the infrared projector, infrared camera and normal camera. The Kinect works by projecting a structured pattern (that looks a bit like a 2D barcode) out into the world. The infrared camera analyzes how this pattern is distorted and reflected to build up a map of distances to the nearest objects in front of the Kinect. Simultaneously the webcam streams conventional video of the scene alongside the 3D data.

With a little help from our friends...

In order to access this data we used two open source libraries: libfreenect (http://openkinect.org/wiki/Main_Page) & libusb (http://www.libusb.org/). There are other options available but the decision was really down to the fact that both provide complete source code, which is always reassuring if you are planning to hack something quite novel ;)

Originally Brian modified the sample app provided, but over the weekend he created a specific MFC app to do a bit of the pre-processing. The API of libfreenect proved pretty straightforward to implement in a completely bespoke project. We then used a custom version of our 3D CNC modelling and manufacturing package, Aspire, to import the data and allow is to tinker with it. Within a day, Bri was convinced that, with a bit of Aspire manipulation, the raw data could be combined and improved enough to produce some pretty reasonable 3-axis machinable results!

Our current version of the process has five main stages:

  • Firstly we use 25 frames of 3D data (captured in 1 second) to average out some of the inherent noise found in a single frame.
  • We also use the bespoke capture app to limit the 3D data to distances that we are interested in, with sliders to remove data in front of, or behind, the target we are capturing.
  • The data is than imported into a custom build of Aspire where a wizard assists the process of aligning the true 3D data, with a low relief created from the web camera image - shadows and brightness changes in the photo are not directly related to 3D shape, but they do add a great deal of detail if used judiciously.
  • The model elements can now be smoothed, scaled or even sculpted individually to produce a nice composite model.
  • Toolpaths can then be generated and the model cut.
  • After a bit more manipulation in Aspire (to lower the head area to reduce the required thickness of material), the model was sliced so that we could cut it in 3 layers using 1" (25mm) MDF.
  • The pieces were then glued together ...

We're going to show the "Kinect yourself to your CNC" process at the San Francisco Maker Faire next week (May 22-23, 2011) and we hope to see as many of you there as we can!