What is Lens distortion and how to correct it?
Lens distortion is something that is common across the vast majority of lenses. This applies to both cameras with integrated lenses, and interchangeable lenses for DSLRs, MILCs, etc. Where a lens should capture a flat view, instead the view is slightly bent or warped in some way.
You might recognize the above photo from the recent article What is Macro Photography? The distortion in this photo is pretty clear. The ruler, which is flat in real life, appears to be bulging up towards the center in the photo. This form of distortion is known as
Barrel distortion. The middle of the image bulges outwards like the middle of a barrel.
Barrel distortion is most commonly found at wide angle focal lengths, that is for lenses with an equivalent focal length less than 50mm. It is not the only type of distortion that lenses may create though. For lenses with an equivalent focal length longer than 50mm, you are more likely to see pin cushion distortion.
Untitled by 10 Ninjas Steve on flickr (licensed CC-BY-NC-SA)
Pin cushion distortion is the opposite of barrel distortion, the center of the image appears to bulge inwards, rather than outwards.
On zoom lenses you may find that you have barrel distortion at the wide end of the zoom (when fully zoomed out), and pin cushion distortion at the long end of the zoom (when fully zoomed in). At the center of the zoom range you will probably find no distortion at all.
As well as varying by focal length, distortion also varies by focus distance. At close focusing distances most lenses display considerably more distortion than they do at longer focusing distances. One exception to this is macro lenses, which are specially designed to give a flat field with very little distortion when focused closely.
There is also another type of distortion, known as moustache distortion.
With moustache distortion, the center of the image is bulged out, like with barrel distortion. Then towards the edges of the frame, the distortion changes to pincushion distortion. The distortion somewhat resembles a handlebar moustache, hence its name.
When does lens distortion matter?
First of all, I should point out that the majority of lenses don't suffer from very much distortion. And what distortion there is can often be corrected (either in camera or in software - I'll come to that in a moment). But even if your lens does have distortion, it might not be visible in your photos anyway.
Lens distortion will only be visible in images where you have straight lines that are clearly meant to be straight. So for images such as people, landscapes, wildlife, a bit of lens distortion won't affect the image in a perceivable way.
For example, the above image was taken with the same lens used for the moustache distortion example. No distortion corrections were applied, but the distortion is much less visible in this image than the one of the brick wall.
Where distortion does become much more evident is when shooting architecture. Here there are often a lot of straight lines, and if a wall looks bendy, we can tell something's not right.
I should also mention that in some cases we positively want distortion. An example would be fisheye lenses. They have extremely strong barrel distortion, which along with their wide field of view, gives them a unique look. They are particularly popular for photographing sports such as skateboarding and BMX.
Stranger #1 - The skating Sandis by Mikkel Rask on flickr (licensed CC-BY)
Correcting lens distortion
Most modern cameras have a built-in database of lens corrections that they can use for correcting lens distortion (and other issues such as chromatic aberration and vignetting). Generally this only works for JPEG images, and for interchangeable lens cameras, only with certain lenses. If you shoot in RAW format, no corrections will be applied, as RAW data is raw, with no adjustments made.
If you prefer shooting in RAW, or you use a lens that does not have distortion corrected by the camera, you can correct lens distortions in software. Most RAW conversion software provided by camera manufacturers will carry out the same corrections on your computer as can be achieved in camera. As the in-camera solution though, automatic corrections will likely not be made for third party (or old) lenses though.
But you can correct these images using manual corrections. The exact names of the settings and way they work can vary slightly between programs. Below is an example using Adobe Camera RAW to correct the image with severe barrel distortion from the start of this article.
I've opened the image in ACR, clicked the lens adjustments button in the adjustment panel on the right, then chosen the Manual lens adjustments tab. This tab has lots of different options, but distortion is the one we want to use.
Now I have adjusted the distortion slider to add pincushion distortion. Since the image is suffering from barrel distortion, adding pincushion distortion just removes the barrel distortion. For an image suffering from pincushion distortion, you would adjust the slider the other way, to add barrel distortion until no distortion was visible.
I used the straighten tool (near the top of the window, looks like two lines with an arrow between them) to straighten the image along the top edge of the ruler. This also allows you to automatically crop away the areas of the image that have no image data in them after the distortion correction.
I turned on the grid view in the Lens Corrections panel options, and this made it obvious that I had added too much correction. The image was now suffering from pin cushion distortion. So finally, I adjusted the distortion correction down until the edges of the ruler were parallel with the horizontal grid lines.
Correcting moustache distortion is a bit trickier. Most image processing software, e.g. DXO Optics Pro, Adobe Camera RAW / Lightroom, and PTLens will correct any type of distortion automatically if a profile for your lens is present. (That is, if the software producers or another user has already analyzed the distortion characteristics of the lens and created a correction profile for it).
For example, above is the previous example image of moustache distortion, corrected automatically in Adobe Camera RAW using a profile added through the Adobe Lens Profile Downloader.
If a profile is not available, you will need to make one yourself. As far as I'm aware, this is only possible for Adobe Camera RAW, and PTLens. The process involves taking various photos of a test chart, then running these photos through the Lens Profile Creator for ACR / Lightroom, or sending them to author of PTLens for PTLens.
To sum up, don't worry about lens distortion unless it is obvious in your photo(s). In this case, fixing it should be quite easy in software. Most of the time when you do come across distortion, it will be barrel distortion. Thankfully the harder to correct moustache distortion is not a problem with the large majority of lenses.