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:
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:
-- about ten times more quickly than I could in GIMP.
Spot the difference:
``Over the last twelve months we have made a step change in how we set about tackling anti-social behaviour with a dedicated Home Office unit [new bureaucracy] to lead the way bringing in tough new powers, helping local agencies [more new bureaucracy] to work together with the community.
[...]
``We have increased the numbers of police officers, community support officers and neighbourhood wardens across the country and given them more tools -- improved ASBOs [anti-social behaviour orders, i.e. more paperwork], acceptable behaviour contracts [more paperwork] and fixed penalty notices [yet more paperwork].
[...]
``Local authorities and communities need to use these tools [i.e., bureaucracy and paperwork], to ensure that the tiny minority are not allowed to continue to blight the lives of the law abiding majority.'' (David Blunkett, speaking at the `the Home Office Anti-Social Behaviour Conference' -- i.e., a talking-shop)
(Obviously it would be inappropriate to judge the likely effectiveness of this new Home Office gimmick^W policy on this basis. It may well be that bureaucracy and paperwork are the best ways to tackle anti-social behaviour. On a slight tangent, a recent report suggested that police officers on patrol aren't much help, but in fact that research was so statistically naive that it wouldn't be safe to conclude anything from it.)
On a different tangent, I was interested to see reports in the Sunday newspapers about Blunkett's ID card scheme going aground in the face of opposition from his Cabinet colleagues on the surprisingly-practical grounds that the cards will be expensive and useless. Of course, you can't believe anything you read in the Sunday papers. Anyway, this morning Blunkett resorted to the time-honoured trick of invoking the vox populi:
``... over the summer and in this autumn, even when I've been travelling, people have come up to me again and again and said `stick to your guns, we know that if we're going to sort out clandestine entry, clandestine working and illegal use of our services, we need some form of identity card: a modern, biometric card that can't be forged.''
... as ever, the idea of a card that `can't be forged' would be hilarious except for the fact that Blunkett apparently believes that it's a practical possibility. As for biometrics, I'll let my previous comments stand.
Of course, objections on practical grounds won't necessarily have much effect, and bringing in ID cards wouldn't exactly be the first time this government has funded something expensive and useless. And if Blunkett is taking his job seriously -- by which I mean trying not to foul anything up too badly at the Home Office while pushing through some big headline-grabbing project or other in order to maximise his chances of being the next Prime Minister -- then ID cards are an invaluable asset. Unlike Jim Hacker, he can't go to work on a sausage; but maybe an ID card will suffice. If his reading of the vox populi is true and people in this country really do want to spend £40 to £400 each on a useless piece of plastic tat then I suppose picking a fight with Gordon Brown over the cost of the thing is probably a good idea.
Update: I should have linked to this Sunday Times story, which also has the text of leaked letters from Jack Straw and Paul Boateng. It's interesting that the list of Straw and Boateng's concerns -- that the card can't be demanded compulsorily in order to get access to services, since not everyone entitled to use the services will have a card; that the payment for the card may be classified as a tax; that the introduction of the card will decrease revenue for the Passport Service and introducing biometrics will increase costs; and that there are legal problems with how the card would interact with travel within the EU -- are quite different from the objections of informed members of the public -- namely, that the card will be expensive, won't solve any of the problems claimed, would infringe civil liberties, and is un-British. The letters assume that the card might be some use; that biometrics are a useful security feature not a gimmick; and, in general, that the card is actually a reasonable idea with some practical problems in its way.
This is all done with wwwitter.
Copyright (c) Chris Lightfoot; available under a Creative Commons License. Comments, if any, copyright (c) contributors and available under the same license.