Battle of the Bulge

Original. In particular, straight lines will be curved under distortion.

A common form of photographic distortion is barrel distortion and its counterpart pincushion. Straight lines such as architectural features become curved and this is distracting, not only for viewing buildings, but also in portraiture, where the barrel distortion will easily make you 5 or so kgs overweight. Photographers will compensate for this by using the zoom to reduce the amount of distortion (and this, as it turns out, is true, although not the whole story).

After removal of radial distortion

The distortions are not so much the product of a cheap lens as such, but arise from stops in front of or behind the lens, as van Walree points out. In fact, the cheapest of my digital cameras, the A470, has better performance in this respect than either of the more expensive ones. And it’s not even that it’s difficult to understand the math behind the distortion, as long as you can get the right terms on the right side of the equations…

Ideal distortion of a regular grid for all 3 of my cameras

But no, everyone attempting to fix barrel/pincushion distortion has decided that they also have to invent new equations for it. ImageMagick started by introducing the Dersch equation, which not only has the terms on the wrong side (because “it was easier to calculate that way”) but also has one term that is totally inapplicable. I won’t go into the details here (you can write on my gravestone, “He went into the details”), but aside from a barrel distortion, they also have an inverse barrel distortion, where not only are the terms still on the wrong side, but one side is the reciprocal of what it should be. Not quite sure what that is good for, but anyhows. From ImageMagick this disease has spread to Panotools and from there to Hugin. The GIMP, another open source graphics software has its own equation which is even more bizarre. And there’s a bug in their “lens distortion” algorithm with regards to centring the image.

But I only wanted to fix the barrel distortion.

In landscapes the distortion is more subtle, but when stitching photos into panoramas, it is significantly disruptive.

Well, here’s how I wanted to set about doing it. With all of my three trusty cameras I would take a set of pictures of a target, at all possible zooms, one after the other. Said target was a set of twelve horizontal lines in black (data lines), with two red lines, one vertical, the other horizontal for centring. Then I would wrote some software to extract the coordinates of the data lines. I would have to be able to perform a pretty mean Fourier transformation if necessary.

Since none of the equations has a solution (so much for the “easy way”), all the values have to be calculated by trial and error, number-crunching pure. The result would be a set of values for all zooms and all types of images (raw and cooked) recorded in a database. The photographers’ portrait tip could be tested. And the photographic results of the interim calculations were satisfactory.

The only problem doing this by hand was controlling all of the zooms. The SX series theoretically has 23 zoom levels and controlling them manually is very much a matter of chance. Not critical in everyday use; but absolutely necessary for a systematic analysis.

Leave a Reply

Your email address will not be published. Required fields are marked *