Kinect and Processing
30.4.2011At a recent Liip Hackday, i worked with the Microsoft Kinect Depth Sensor. I took Processing Simple-OpenNI and added the "push" and "swipe" detectors. To install the processing openni library, you first need the Kinect drivers, OpenNI and NITE. We were successful with the guide of SensorKinect. Then you get the trunk version from google code.
It would be cool to alternatively use some gesture library that works on normal webcam images. Maybe the list of image libraries on processing.org holds a useful library. Or ezGestures to have mouse gestures.
The processing application listens for events from the kinect and provides them over a web socket. To provide the data, we needed a WebSocket implementation for the Java side. On a first attempt, I found only bloated stuff (well its Java, seems to be normal there) that brought Tomcat or even JBoss into the game and would have made it pretty complicated to just open a socket connection. After wasting some time trying to "quickly" implement it ourselves (the handshake is really pretty freakish) I finally found the Java-WebSocket library which perfectly suited our needs.
Dan built a page with HTML5 WebSockets and the jQuery HTML5 Carousel. The client simply connects to the server and listens for messages like "push", "swipeleft" and "swiperight". To run, you need a web socket capable browser like Google Chrome or Firefox 4.
The code Dan and I created is available on github (processing project and HTML page with Javascript) .
More Information and some videos are in the Liip Blog post.