Sunday, October 15, 2006

Barrel Distortion Correction


..and Pincushion Correction

Typically, wide angle lenses tend to suffer from barrel distortion and tele lenses from pincushion distortion. Both effects tend to be stronger at the extreme ends of zoom lenses, especially on compact cameras.

The good news is that for digital cameras, these problems can be rectified very easily. Here's how.

Installing Panorama Tools

Panorama Tools (download here for PC or here for Mac) is an excellent freeware plug-in for Adobe Photoshop Elements 1.0 and higher, and Photoshop 5.0 and higher. The plug-in allows for amazing barrel and pincushion distortion corrections.

The Readme file of the plug-ins explain all the parameters. For those of you with limited time and only interested in barrel and pincushion distortion, simply install as follows for Photoshop in Windows 95/98/Me/2000/XP (for Mac and/or other software please refer to the Readme file):

  • Place the file pano12.dll into the same directory as Photoshop.
  • Place the files adjust.8bf, correct.8bf, perspect.8bf, and remap.8bf into the Plug-ins folder for 'Filters'.
  • For the scope of this tutorial, these are the only files you will need. So don't worry about the other files in PanoTools.zip.
  • Restart Photoshop. You should find Panorama Tools in the Filters submenu.

For barrel and pincushion distortion compensation, go to "Filter-> Panorama Tools-> Correct". Highlight "Radial Shift", click on "Options", set 'a' and 'c' to zero for all colors, choose a value for 'b' and choose 'd' so that d + b = 1. For barrel distortion compensation 'b' must be negative, for pincushion distortion compensation, 'b' must be positive. Start with b = -0.015 or 0.015 (1.5%) respectively and increase or decrease until the picture is straight. The Readme file also explains 'a' and 'c', but you probably will not need those parameters.

The sample pictures below are downsampled, but be assured that there is virtually no visible loss of quality or sharpness between the original before and after pictures, provided the Photoshop's default bicubic interpolation is used. The perfectionists among you may notice small differences when viewing the image at 400% or more. These differences are irrelevant to image quality and are definitely a bargain price to pay for the very relevant and obvious elimination of the distortion.

Barrel Distortion Correction

Notice the very curved horizon and right building in this wide angle shot. Settings: a=0, b=-0.016, c=0, and d=1.016 results in straight horizon and building.

Another example of barrel distortion with wide angle lens. Settings: a=0, b=-0.018, c=0, and d=1.018 results in a straight window.

Pincushion Distortion Correction

Example of pincushion distortion with a tele lens. Settings: a=0, b=0.013, c=0, and d=0.987 straighten the building.

After pincushion distortion correction you will have to crop the image about 25 pixels on top, bottom, left and right to remove the black pixels in the corners and around the edges resulting from the transformation.

Conclusion

Barrel and pincushion distortion can easily be eliminated without visible loss in quality.

This article is based on content of The 123 of digital imaging Interactive e-book, which explains barrel and pincushion distortion correction in more detail.

1 comment:

Unknown said...

I love all kind of photos, it drives me crazy. I think every photographic is a work of art. Like the site costa rica homes for sale all the beautiful houses are wonderful and the pictures are great.