My students for the Digital Media Studio Project here at the University of Edinburgh have asked me to present a small workshop on using some aspects of the Processing.org environment. I’ve worked up something and thought I could share it online as well. I’ve setup a google code repository with the necessary files. The code simply highlights what you could find throughout the Processing.org discourse and the OpenCV example files though is more thoroughly commented and organized.
A few notes, I really dislike the Processing IDE. Maybe it’s just because I’ve used IDE’s like VS, Netbeans, Eclipse, XCode etc… and I haven’t really played with Processing enough to have a well founded basis in the functions available. I believe going through a few extra steps to setup an IDE like Eclipse makes the task of programming much easier though at the cost of a bulky editor that may not be so easy to setup at first…
Eclipse is an (Integrated Development Environment) IDE for many coding languages, one of which is Java. Some advantages:
- code completion – automatically see possible choices for all members belonging to a class definition, such as functions and their arguments.
- javadocs – javadoc is a formatting for writing code comments. by following a simple format, javadocs can produce a nice html document outlining all the functions/members/arguments/what to expect etc… – while coding, having the ability to see javadocs is invaluable as memorizing all of the members of a class is often not ideal.
- browsing libraries – along the lines of javadocs, being able to see the definitions of a class are much easier than having to memorize all the functions belonging to something like processing.core.PImage – and with the eclipse environment, you can view the javadocs along with the libraries.
- debug – step through your program and view the stack trace, threads, and all the messy hex numbers.
The biggest disadvantages are that it takes time to setup a project, include files, and write the class definitions, none of which you will have to do in the Processing IDE. Luckily, there is a nice tutorial for setting up Eclipse to use the Processing libraries: http://processing.org/learning/tutorials/eclipse/ – I recommend going through this thoroughly.
OpenCV is an open source, cross-platform library developed by Intel and used widely by researchers in fields such as medical imaging, artificial intelligence, and interactive art. There is a nice port available that includes a minimal though nice set of functions for the Processing and Java environment: http://ubaa.net/shared/processing/opencv/ – This page provides detailed instructions and very nice documentation on setting up the OpenCV environment. If you are on OS X and are looking for the Java Extensions folder, try the folder: /Library/Java/Extensions.