Tuesday 22 February 2011

Using Kinect to control Jmol - Part II

Continuing from Part I...

Rather than write Java code that interfaces directly with the Kinect we are going to make our lives easier by taking the information we want from the Kinect and making it available through a port. We can then read the information from the port using software in any language, not just Java.

Here's one someone else made earlier: OSCeleton.

(1) Click on the Downloads button at the OSCeleton Github page (on the right hand side) to get an .exe for Windows.

(2) Unzip it, and run the executable.

(3) Stand back from the Kinect and assume the calibration pose (classic "hands up" posture, with elbows at 90 degrees, see this example) until you see the message "The calibration was finished successfully".

You are now being tracked, and your movements are being broadcast using the OSC protocol to a port on your machine.

Now we're going to use Python to tidy up the broadcast data, smooth it a bit, draw it on screen, and rebroadcast it for Jmol.

(4) Install pyliblo. The website for pyliblo does not include a Windows .exe, so I used the one from touchpy. Note this requires Python 2.5.

(5) Install pygame and pyopengl (both of these can be installed with easy-install.exe).

(6) Clone my git repo. This is a fork of code by Ben O'Steen that adds support for Python 2.5 (see above) and smoothing.

(7) Run osc_hand_viz.py. You will see an image similar to the image at the end of Ben's recent blog post on using the same code to control an ARDrone.

Image: Scott & Elaine van der Chijs

Tuesday 15 February 2011

Using Kinect to control Jmol - Part I

A few weeks ago I showed a video of me appearing to control Jmol simply by waving my arms around. Now you too can appear to control Jmol in this way.

My instructions are going to be minimal, so your mileage may vary, but here goes...

1. Get a Kinect. You don't need to buy an Xbox. The Kinect costs about 150 euros.

2. Install all of the Kinect drivers and so forth. I'm on Windows and I followed the instructions by Vangos Pterneas (note that I needed to follow the "Troubleshooting" section to get things to work). Ben O'Steen was using Ubuntu at the hackfest and followed the instructions at keyboardmods.

If you did it all correctly, when you plug in your Kinect the driver should be found by Windows. If it isn't, just go through the instructions again.

Once the Kinect is installed, in your Windows menu try OpenNi/Samples/NIViewer - this should give the view from the camera and depth sensor. Also try PrimeSense/Samples/PointViewer to play with hand tracking.

Image: Creative Tools

Monday 7 February 2011

The book stops here - Self-publishing in cheminformatics

Self-publishing, combined with print-on-demand, is something of a distruptive technology. It removes a huge barrier to publication, namely convincing a publishing house to take on your manuscript. Even if they do, for a book with projected low sales (for example, a book on cheminformatics), this usually means high prices and fewer readers.

With self-publishing, all you need is a PDF (or even Word doc), upload it over at Lulu (or one of the alternative self-publishing websites), and a couple of questions later your book is available for sale. No fee. And it's profit from the word go - a proportion of the cost of the book pays Lulu, and the rest goes into your pocket. Getting it listed on Amazon costs a few pounds, but it's also very easy to do.

I first heard about this in cheminformatics when Angel Herraez published the Jmol handbook (also available in Spanish) back in 2007. He makes the interesting comment on the book website that it's fairly easy for him to generate a customised version of the book for use on a course - I don't think that'd work with traditional publishing.

More recently, i.e. yesterday, Egon Willighagen published Groovy Cheminformatics with the Chemistry Development Kit. This covers the use of the CDK cheminformatics toolkit. The Groovy in the title is not the 70s vibe, but rather the Java scripting language.

Makes you think eh? What would you write a book about?

Update 13/02/11: The Cactvs Scripting Manual is also self-published with Lulu (see comment by WDI below).