This chapter was previously labelled as "NUI Chapter 16.8".
Most of my NUI examples utilize a webcam input class called JMFCapture which retrieves video frames as sequences of BufferedImages. The aim of this chapter is to reimplement JMFCapture to use the Kinect camera as its input source. This renamed KinectCapture class has almost the same interface as JMFCapture, allowing it to be used as a "drop-in" replacement for JMFCapture.
To prove the point, the next chapter will look at using the Kinect as an input source for OpenCV (the popular computer vision library). I'll utilize OpenCV (actually, its Java binding called JavaCV) to implement a simple kind of motion detection. The algorithms (and code) in that chapter are identical to the online NUI chapter on motion detection. Only a few lines have been changed so a camera variable refers to a KinectCapture object rather than a JMFCapture instance.
The focus of this chapter is on implementing KinectCapture, together with a small test-rig to show how to grab images and display them in rapid succession in a JPanel. The panel output includes the number of pictures displayed so far and the average time to take a snap, information that'll help me implement suitable processing rates in later stages. The screenshot at the top of the page shows the CapturePics application.