Instead of a dissertation, my AI degree requires me to take on a final year project. My project involves writing software to get information from a webcam attached to a remote controlled toy car and using that information to drive the car, all wirelessly.

When I started it last September, the obvious language choice was C++ and the only obvious way I found of getting images from the webcam was using Microsoft DirectShow. When I say obvious I mean that there was plenty of documentary evidence that this was possible; there was very little on how to actually achieve it. Even when I found examples they wouldn’t compile and they were a mess of COM initialisations and C++ weirdness. I persevered with limited success all last semester then halted development over the holiday and exam (and subsequent holiday) periods to concentrate on other things.

I came back to it last sunday to find that now nothing compiles at all – not even the stuff that worked before! The prospect of trying to debug this code all over again – code I didn’t really understand the first time round, let alone several months down the line – made the evening of Sunday 13th February 2005 a very dark time in my life.

Then I hit upon the idea of using Java. I had originally discounted Java as too slow for real-time image processing but since C++ wasn’t working out I decided something that works slowly has to be better than something that fails to work very fast. Java has an extension called the Java Media Framework (JMF) which makes getting images from a webcam trivial.

So I gave it another try: in 6 hours I achieved as much using Java/JMF as I had in several months using C++/DirectShow! If it turns out Java really is far too slow I can always write the image processing algorithm in C and call it via JNI.

<sigh> aaaah…. that’s better.