Netzstaub has been pumping out all kinds of great code and projects over on his blog. Here’s an especially sweet example: he’s got Processing working with a basic headtracking process. The input involves oscp5 and netp5 used with the Mac-only DarwiinRemoteOSC library, but could be adapted to other operating systems.
Once the data is there, the rest is basically math. You position the camera to look straight ahead, and then adjust the viewing angle based on incoming data.
The sketch is available, so go try it — and see if further improvements or other applications are possible.
In case you aren’t already familiar with it, here’s the now-famous video featuring Wiimote headtracking, by Carnegie Mellon’s Johnny Chung Lee: