Every now and then, I blast out the cruft from my nerd gland’s exit duct by writing a terribly nerdy post. This is just such a post, so if you don’t speak Nerd, i’d highly recommend that you go have some fun elsewhere, at least until my next Weekly Head Voices of course!
As mentioned around these parts, I’m currently playing with Processing, a beautiful programming stack for making interactive visual, err, thingies. To be more specific, I’d like to use processing together with something like ARToolkit to do real-time 3D tracking of markers in live video, for augmented reality fun. To see what this could look like, see this YouTube video:
Today’s challenge is getting whole stack, including processing, the GSVideo video capture library for processing and the NyARToolkit augmented reality for processing going on Linux x86_64 (64bit). On Linux x86 (32bit) this is much more straight-forward, but I wouldn’t write a blog post about straight-forward, now would I?
Here is the recipe:
- Make sure you have the native 64bit Sun JDK installed for your system. On this Ubuntu 9.10 machine it’s sun-java6-jdk 6-15-1, on Ubuntu 10.04 (also tested) it’s 6.20dlj-1ubuntu3.
- Also install the jogl libraries, on this machine called libjogl-java.
- Make sure you have the whole of gstreamer installed. On ubuntu, all packages containing “gstreamer”.
- Get and unpack the processing for Linux tarball (I’ve tested this whole procedure with processing 1.0.9, 1.1 and 1.2.1) from the processing download site.
- In the unpacked processing directory, remove the whole java subdirectory. Now make a symlink pointing to your system java directory (the one containing bin, ext, jre, lib, etc.). On my system, that was:
cd processing rm -rf java ln -s /usr/lib/jvm/java-6-sun-188.8.131.52 java
- In processing/libraries/opengl/library remove the 3 libjogl*.so files and libgluegen-rt.so. Symlink their replacements from /usr/lib/jni with for example:
cd processing/libraries/opengl/library rm lib*.so ln -s /usr/lib/jni/libgluegen-rt.so ln -s /usr/lib/jni/libjogl_awt.so ln -s /usr/lib/jni/libjogl.so
- Download and unpack gsvideo into processing/libraries. You should be able to run the examples in processing/libraries/gsvideo/examples/Capture with the PDE (Processing Development Environment).
- Download and unpack the NyARToolkit for Processing library into processing/libraries.
You should now be able to run the NyARToolkit examples by changing replacing the import call as follows:
// replace this call: // import processing.video.*; // by this call: import codeanticode.gsvideo.*;
and changing the Capture class (twice) to GSCapture and perhaps also the capture resolution, depending on your camera. The relevant conversions are:
// Capture cam; // becomes: GSCapture cam; // later, in setup(): // cam=new Capture(this,width,height); // becomes: cam=new GSCapture(this,width,height);
The major trick in all of this is converting your Processing installation to use your system 64bit JDK instead of its own built-in 32bit JDK.
Let me know in the comments if this worked (or didn’t) for you!