Lens distortion correction on post-processing
This form of optical aberration is caused by how the lens projects the light rays over the flat sensor or film surface. A perfectly rectilinear lens would project the light rays absolutely aligned on the sensor plane, no matter where on the frame, while a real world lens, always bearing some degree of distortion, bends those rays unequally throughout the frame. This distortion doesn’t depend on the focal length of the lens, although it’s more often seen on wide angles or megazoom lenses.
Types of lens distortion
Image magnification decreases with the distance from the frame central point, causing a subtle fish-eye effect, as if the image were projected on a spherical surface. Straight lines near the frame edges bend away the frame center.
It’s the opposite of barrel distortion. Image magnification increases with the distance from the frame central point, as if the image were projected on a concave surface. Straight lines near the frame edges bulge toward the frame center.
Mustache distortion, also called complex distortion
It’s a mix of barrel and pincushion distortion, gradually varying from the frame center to the edges. This is the most difficult type of distortion to correct, as it may change with the focal length on zoom lenses, and requires a more complex mapping to be neutralized. Photoshop’s Lens Distortion and Spherize tools won’t help you here.
Don’t confuse perspective with distortion
Lens distortion and perspective distortion are two different things. Perspective distortion is caused by distance from the camera to the subject, regardless of the lens used. If you take the same picture on a telephoto and a wide angle lens, but crop the wide angle image to have the exact same coverage, the two lenses will show the same amount of perspective distortion. Since different focal lengths have different coverages, you have to get closer to your subject to fill the frame with a wide angle lens, thus leading to more perspective distortion.
Wikipedia has a nice article explaining it better than I could.
Why correct lens distortion
Curved buildings and distorted faces are easily detected by our brain, looking unnatural. If you shoot a portrait, correcting the lens distortion can give you a more pleasant rendition of the model’s face. For architecture photographers it’s even more important, since it’s impossible to have a perfectly adjusted perspective if the image has lots of lens aberrations and distortions.
In-camera lens distortion correction
With the advent of digital photography, it became easy for manufacturers to compensate for lens aberrations with software. Some cameras might even apply that correction in-camera, before any file is written. Even the LCD preview is corrected this way.
By compensating for the optical imperfections in software, manufacturers can design lenses that are far from ideal optically, but cost less and are smaller and lighter. This is especially important in the compact camera market, where price and size are two of the most important factors.
For example, Canon takes this route on their highly regarded Powershot S90 and S95 compact cameras. Panasonic uses it on the LX3 and LX5 models. Olympus Micro Four Thirds cameras, like the E-P2 and E-PL1, correct for geometric distortion in software, while Panasonic’s Micro Four Thirds models go a step further and also provide chromatic aberration (aka. purple fringing) correction.
Recent Nikon DSLRs also compensate for chromatic aberration through software—in-camera, for JPG files, or by embedded information on RAW files. I’m a Nikon user and this is one of the reasons I use Nikon Capture NX2 to process most of my RAW files. The chromatic aberration correction is perfect, effortless, and I could never match it on other raw converters.
Fixing lens distortion on post-processing
My tool of choice for fixing lens distortion is PTLens. This inexpensive program (US$25) works on Windows and MacOS computers; integrates with Photoshop, Aperture, and Lightroom; and has an extensive database of lenses. It can also be used for perspective correction, which comes in handy for architecture photography. PTLens also has tools for vignetting and chromatic aberrations, but I prefer to handle those on my RAW developer. PTLens comes in on the last phases of my workflow, after I export the processed RAW file to a master 16bit TIFF.
Nikon Capture NX2 has an auto distortion correction, but that works only on Nikon G or D type lenses. I use it sometimes, but I have some third-party lenses from Sigma and Tokina, so it’s not a complete solution for me.
Adobe Lightroom 3 and Photoshop CS5 now have a lens correction module that handles distortion and chromatic aberration. It has worked very well in my tests, and Adobe has added several lenses to their latest Lightroom and Camera Raw updates.
Take note, however, that more complex distortion patterns on zoom lenses, such as the Canon 24-105mm f/4L mustache distortion, are not handled so well by Lightroom and Photoshop CS5. Adobe’s documentation for the Lens Profile Creator recommends using six different focal lengths for creating wide angle lenses profiles. PTLens, on the other hand, uses up to 12 focal lengths, producing a more accurate profile. You can see some examples of this difference on this page—Lens correction on the left menu.
Canon Digital Photo Professional—DPP—raw processing software also provides a module for fixing lens distortion, chromatic aberration, and vignetting, but only for some camera and lens combinations. Third-party lenses are not supported.
DXO Optics Pro is a pioneer in this field and was the first program to incorporate lens correction during the raw development phase. The current version—6.2—is a very capable RAW processor and offers fully automated lens correction. You don’t even have to think about it. Just open your RAW file and all corrections are handled automatically, including some corrections that other RAW processors don’t have, like Lens Softness and Volume Anamorphosis—a fancy algorithm to handle spherical volumes, like faces, on the edge of wide angle frames, balancing distortion correction and object geometry.
The main drawback of fixing lens distortion is that you lose a little part of the original frame as it’s stretched or compressed to compensate for distortion. This process also slightly decreases image quality on the affected areas. Usually the difference in image quality is negligible and more than made up for by the better aesthetics of a corrected image.
In-camera distortion correction Can software ever take the place of optical excellence? - Dpreview.com
Lens distortion - DXO Optics
Lens Perspective. Distortion and the face - Stephen Eastwood Photography