14 October, 2003: Imagination

[ Home page | Web log ]

After complaining yesterday about how tedious stitching images into panoramas is using GIMP, I finally decided to take a look at VIPS, a free image processing tool which is described as `half way between Excel and Photoshop'. (If the idea of that combination fills you with nameless dread, I suggest you don't read any further. I understand that this sort of geeky stuff puts off a substantial fraction of my half-dozen readers or whatever it is now. Sorry. I should probably also apologise for the worsening quality of the article titles here....)

VIPS is pretty cool. It's an enormous UNIX program which is a slight pain to compile, but if you're the sort of person who's willing to endure this sort of pain for `fun', that won't be too much of a barrier. Basically it consists of an image-processing library which supports a bunch of high-level operations (add, subtract, rotate, translate, ...) on images and related objects (points, lines, regions, matrices...). For those playing buzzword bingo, it does so via a pure lazy functional language with classes (put that in your shell and smoke it...), though it also has a GUI (`NIP') which exposes the high-level operations as an alternative to writing code. Rather entertainingly, when the GUI starts up, it displays the message,

© 2003 The National Gallery

-- which is nice for those who like to think of their random image editing as `art'. (The software is used for processing data such as infra-red reflectograms acquired while restoring paintings, which is presumably why the National Gallery has an interest in it; there's an example of the kind of thing in the documentation.)

One set of VIPS functions is used to create mosaics of images. The idea here is that you nominate similar points in pairs of images, and tell it to search for the best match via either a translation or an arbitrary linear transform. The user-interface is rather nice:

VIPS screenshot

Each image or other object you create occupies a cell, like a number would in a spreadsheet. In the simple example above, there's just one column, but you can have lots of columns if you want (I haven't used this yet and aren't quite sure why I'd want to. Whatever). Any operation you do creates a new cell. So in the above example, I load two images which become A1 and A2. I then identify two corresponding points in those images, which are A3 and A4. I then do

Mosaic_translate.Left_right(A3, A4)

(there's a menu option for that...) and VIPS figures out how best to glue the images together into a composite. (Unlike, for instance, pnmstitch, this step actually works....) The last step is an operation to balance the contrast between the images in the mosaic, so that the colours are consistent throughout. This step isn't perfect, but it's a damn sight better than manual adjustment using the `curves' tool in GIMP. I haven't yet got it to do all the colour adjustment I want -- in particular spatially-varying adjustment to fix variations in colour around the edges of the image caused by suckiness in my camera -- but VIPS is clearly powerful enough to manage it -- given enough time to learn how. (Attempts so far have made it crash. Natch.) Helpfully the manual for its internal API consists of a list of functions with the useful caption,

Table 6.4: Useful utility functions -- see the source for details

(Truly this is the future of software.)

Anyway, here's another panorama I knocked together fairly quickly with this thing:

Another Norfolk panorama

-- about ten times more quickly than I could in GIMP.


Copyright (c) 2003 Chris Lightfoot; available under a Creative Commons License.