George Mather
Programming

I have programmed in a wide range of languages over the years. Early programs were written in Basic, Fortran, C, and Assembler on PDP-11 minicomputers and the first DOS-based personal computers. As PCs developed and diversified, so did their programming languages and my programming skills: Early Apples, Amigas, Windows PCs, Silicon Graphics workstations, and VSG-based PCs, running C, Pascal, Java, Visual Basic and so on.

In recent years Matlab has become the default language in my lab, largely so that students and post-docs are able to leave with a transferable programming skill rather than intimate knowledge of an arcane and probably short-lived flavour of a platform-specific language. I have also used Adobe Flash, JavaScript and Processing for particular tasks.

This page summarises some of the attributes of the different languages I currently use, and offers suggestions for how to use them to conduct research or to create the demonstrations like those you can find on other pages of this site. The page is a work-in-progress; mu aim is to update with new elements as time allows.

Matlab

Matlab has become the dominant programming environment in many technical and scientific fields. In the field of vision science, the availability of free high-quality code libraries such as Psychtoolbox and Cogent has ensured that Matlab is now almost ubiquitous. The high cost of Matlab is usually covered by the host institution's site license, which often permits installation on personal computers.

I have a love-hate relationship with Matlab. On the one hand it is supremely versatile and convenient, with a huge set of toolboxes and plentiful example code on the web. Familiarity with Matlab is becoming essential for employability as a young vision scientist. On the other hand it is a scripting language and was never meant to be a 'proper' programming language like C or Java. Variables do not have to be declared or initialised, for example, and Matlab's handling of arrays is deeply counter-intuitive (at least to someone brought up on C, Java, etc.). Matlab never ceases to surprise me in its ability to (allow programmers to) generate bugs in programs. Furthermore, as a scripting language Matlab is not the best choice for accurate real-time control of fast graphics systems. Nevertheless, fast modern processors and natively-coded libraries allow Matlab to get away with this trick.

Despite these reservations, Matlab is probably the best choice as a general-purpose programming tool for vision research.

Resources for Matlab:

Modelling motion detection in Matlab

Processing

Processing is described by its developers as "an open source programming language and environment for people who want to create images, animations, and interactions." It has gained some traction among artists, but is also potentially useful in vision science. Processing is free, easy to install and use, and based closely on Java. Its focus on images and animations means that the code required to produce this kind of content is very simple and easy to write. Animations run fast. The Processing web site also contains many useful code examples.

If I need quickly to code some image frames for a non-interactive visual demonstration, Processing is the tool of choice. Matlab is not well suited to drawing and saving bitmap images. The workflow is to create and save the frames needed for the animation with a small Processing program, and then import the sequence of images into the QuickTime Player or Matlab in order to output a movie. Many of the demos you will see on my site were created in this way.