Correcting Barrel and Pincushion Distortion using Corel Photo-Paint.
Introduction to Barrel and Pincushion Distortion
Barrel distortion is a lens effect which causes images to be spherised at their centre displaying a slightly convex curve on straight lines. Barrel distortion is associated with wide angle lenses and only occurs at the wide end of a zoom lens. It is most noticeable when you have a very straight edge near the side of the image frame. Although barrel distortion can be visible sometimes and annoying to some, it is not noticeable in most photographs.
The opposite effect, Pincushion distortion, is a lens effect which causes images to be pinched at their centre. Pincushion distortion is associated with zoom lenses or when adding telephoto adapters and only occurs at the telephoto end of a zoom lens. It is also most noticeable when you have a very straight edge near the side of the image frame.
Due to the compact, and often cheaper nature of their lens systems, most compact analog and digital cameras with zoom suffer from barrel distortion and pincushion distortion.
The Bad News and The Good News.
The BAD news is that Corel Photo-Paint does not have any tools specifically designed to correct problems such as these.
Photo-Paint has a spherize effect tool () and a Pinch Punch tool ( ) but neither of these has the fine adjustment cababilities or the correct algorithm required for the task.
The GOOD news is that there are several excellent, FREE plugins that fix these problems and which work flawlessly with Corel Photo-Paint. Here they are:
1. PanoTools (Panorama Tools Plugin) from Helmut Dersch.
web site, download, ( http://home.no.net/dmaurer/~dersch/Index.htm )
2. Lens Distortion Corrector by Richard Roseman.
web site (see photoshop software section), download .
OK, But there is still a bit more bad news, sorry....
Unfortunately, possibly due to some problem in Corel Photo-Paint versions 9 and 10, the PanoTools plugin will not work properly with versions 9 and 10. BUT IT DOES work perfectly well with Corel Photo-Paint versions 8, 11 and 12+.
HOWEVER, Richard Roseman's Distortion Corrector Tool will work with all versions of Corel Photo-Paint from version 8 onwards. Although this tool does not have all the features and power or PanoTools, it corrects Barrel and Pincushion distortions fairly well.
So in order to correct barrel and pincushion distorion in Photo-Paint correctly, we really need to ujse a plug-in.
Select the plug-in tool you wish to use:
Have a look through your image collection to locate an image you need to correct. For the purposes of this tutorial I have provide two images here. If you want to try the technique on my images. click the thumbnail to display the larger working version, then save it to your disk from the browser:
- Sample Image #1 (Figure 3) displays barrel distortion most prominently seen in the curvature of the ground plane in the upper part of the image. Click on this image to download the full-size version.
- Sample Image #2 (Figure 4) displays barrel distortion most prominently seen in the curvature of the sides of the window frame.Click on this image to download the full-size version.
Helmut Dersch's Free Panorama Tools plugin
Panorama Tools, created by German software writer Helmut Dersch, is suitable for use with Corel Photo-Paint versions 8, 11 and 12+ but does not run correctly in Photo-Paint versions 9 and 10 (reason: unknown). This plugin set allows you to easily and accurately correct for barrel and pincushion distortions as well as other image corrections, panorama creation, remapping and many other tools. For the barrel and pincushion distortion exercises describerd in this tutorial, we will only be using a small fraction of the abilities of this terrific plugin
Panorama Tools for Windows, Mac and Linux, other tools, and all information can be downloaded from : Panorama Tools
Installing the Panorama Tools plugin.
- Download the PanoTools.zip file from the link above and extract/unzip it (you can get the ZIP compression/decompression tool WinZip from www.winzip.com ). A newly created “PhotoShop Plugin” folder will appear where you unzipped the files. This folder contains all the plugin files and a Readme file. Read this file carefully.
The following instructions refer to installing the plugins for Corel Photo-Paint on Windows (95, 98, Me, 2000, XP...) users. Mac Photo-Paint users please read the Readme file after decompressing the archive.
- place the file pano12.dll into the same directory as Photo-Paint (e.g.C:\Program Files\Corel\Corel Graphics 11\Programs\ or similar)
- create a new folder called PanoTools in the Plugins folder of your image editor, (e.g. C:\Program Files\Corel\Corel Graphics 11\Plugins) and place the files adjust.8bf, correct.8bf, perspect.8bf and remap.8bf there.
- Restart Photo-Paint and you will see the Plugins in your Effects menu.
NOTE: If you use more than one image editor (e.g. + Photo Shop) and want to use Pamorama Tools with all of them, then :
- place the file pano12.dll in your /windows/system folder (or WINNT/system for Win2000).
- copy the adjust.8bf, correct.8bf, perspect.8bf and remap.8bf files in your application’s plugins/filters folder or in a new PanoTools folder within in your applications plugins folder.
- Restart the application.
Don't worry about the other files in the PanoTools.zip extraction - I will not be dealing with them here. If you wish to learn how to use the other tools in the Pamorama Tools set, please read about them in the Readme file.
For use in this tutorial, the following files are the only ones you will need: adjust.8bf, correct.8bf, perspect.8bf and remap.8bf
The Panorama Tools plugin 'Correct' Function.
For barrel and pincushion distortion compensation we need to use the Correct function in Panorama Tools ().
Barrel Distortion Correction of the Sample Images
Here are the steps to correct the barrel distortion in the two sample images.
Open either of the images in Photo-Paint then use.
- Check the Radial Shift box only, then click the Options button to open the Set Polynomial Coefficients entry box.
- Set the Correction Mode radio button to Radial.
- Set the a and c values to zero for all colours.
- The b and d values are the important ones we need to use for barrel and pincushion distortion correction. For barrel distortion correction the b value must be negative, for pincushion distortion correction, b must be positive. The value for d must be such that d + b = 1.
- For most images, the b and d values are only fairly small. Values for b are usually between ±0.01 and ±0.025 (1% - 2.5% correction).
- Start with b = -0.015 or 0.015 (1.5%) respectively and increase or decrease until the picture is straight. The manual explains also about 'a' and 'c', but you probably will not need those parameters.
Sample Image #1:
Radial Shift Settings: a=0, b=-0.016, c=0, and d=1.016. Straight horizon and building.
Sample Image #2:
Radial Shift Settings: a = 0, b = -0.015, c = 0, and d = 1.015
Image #2 also requires a Shear correction. Bring up the Correct dialogue box again, uncheck the Radial Shift checkbox and check the Shear checkbox, then press the Options button for Shear. Use Vertical = -5 Horizontal = 10. Then press OK twice.
To see a small animated version of the corrections for thes two images, click the thumbnails below to open a pop-up box.
REPAIRED SAMPLE IMAGES (rest your mouse over the low-res images below for 5-10 seconds to load and view an animation of the results.)
Pincushion Distortion Correction using Pano Tools
For our Pincushion Distortion correction example I have chosen image 852093.jps from CDGS 11 CD#4, in the Photos\Architct folder. Images of tall modern buildings photographedat the high end of a zoom lens are excellent cadidates for this type of distortion.
To download this image click on the image thumbnail of Figure 6 to display the full-sized version.
Once you open this image, display the rulers (). Drag a couple of vertical guidelines from the LHS ruler and line them up against vertical lines in the image on both sides. Now the pincushion distortion can be clearly seen.
As mentioned above, to correct pincushion distortion using, the b value must be positive. And the value for d must be such that d + b = 1.
Thus for the sample image:
Radial Shift Settings: a = 0, b = 0.012, c = 0, and d = 0.988
The image still isn't perfect and requires a small amount of cropping. Click on the thumbnail here to view an animation of the result.
REPAIRED SAMPLE IMAGE (rest your mouse over the low-res image below for 5-10 seconds to load and view an animation of the result.)
Now the walls are straight again. After the pincushion distortion correction you will need to crop the image a little to remove the black pixels in the corners and around the edges resulting from the transformation.
Richard Roseman's Free Lens Distortion Corrector.
Simply place the lenscorrect.8bf file in the Plugins folder of your version of Corel Draw Graphics suite. The plugin will then appear in the menu under
The interface for this plugin is completely different from that of Pano Tools (below)
Lens Distortion Corrector Interface
Description of functions:
- Horiz, Vert: These sliders control the amount of distortion correction introduced in both the horizontal and vertical axes respectively.
- Lock Vert>Horiz: Locks the vertical slider to the horizontal for proportional distortion correction.
- Color out-of-range: With pincushion distortion, pixels that are grabbed from outside the image boundaries are colored using the selected color.
- Presets: This drop-down menu defines what type of camera lens has been used and presets the appropriate distortion correction.
NOTE: Custom allows user input while all other settings lock sliders to preset values.
- Out-of-range color: This color specifies the out-of-range color.
- Fit: This pushbutton stands for fit-to-window. When this is selected, the image is scaled to compensate for distortion corrected size differences.
- Realtime: Applies all effects (in realtime) on 'mouse drag' instead of on 'mouse release'.
- R,G,B: These pushbuttons toggle which color channels to output.\n\nSub-Sampling: Specifies what type of pixel sub-sampling to use. (Nearest Neighbor being fastest, Bicubic being best.)
Barrel Distortion Correction using the RR Lens Distortion Corrector
1. Load the Barrel Distortion Sample Image #1
2. Ensure your rulers are visible () then drag a guideline from the horizontal ruler to just above our young lady's head (near the grass horizon). This provides us with a guide to the amount of correction required.
3. Useto start the plugin
4. For sample image #1, the 35mm preset does a fairly good barrel correction job. Choose the 35mm preset and press OK. The correction takes a moment or two to process. Use the Undo/redo icons on Photo-Paint's Standard Toolbar to see the differrence, noting the area near your guideline.
5. If you would like to experiment further with this plugin, undo, then open the plugin again and change the Vertical and Horizontal adjusters (try both locked and unlocked states) and see if you can improve the result. I found that a setting of H=10, V=50 with FIT turned on also achieves a good result for this image.
6. Load the Barrel Distortion Sample Image #2.
7. Open the RR Distortion Correction plugin once more. For this image I found that a setting of H=28, V= 7, FIT=off worked quite well. The bottom left of the image is not corrected as well as for this image using Panon Tools but still the result is much better than the original. The image needed a little further work: Clockwise rotation of 0.8 degrees (, use maintain size and anti-aliasing on) and cropping to remove the plugin generated black artifact at the bottom.
Pincushion Distortion Correction using the RR Lens Distortion Corrector
1. Load the Pincushion Distortion Sample Image.
2. Ensure your rulers are visible () then drag guidelines from the vertical ruler and position them about 1cm from each side of the image. This provides us with a guide to the amount of correction required.
3. Useto start the plugin. Experiment with the settings. I found that settings of H=-20, V=0, FIT=on achieved a reasonable result but the overall result was not as good as that achieved using Pano Tools. The corrected image still displayed some pincushioning on the bottom left side and cropping was required to remove the introduced black artifact around some of the edges.
So now you do not need to worry too much whether the digital camera you are thinking of purchasing is susceptable to barrel or pincushion distortion, especially if it otherwise has all the features you desire. Now you know that it can be easily corrected using Photo-Paint and some terrific free plugins.
In general I found that although the Richard Roseman Distortion Corection plugin was easier to use than Pano Tools, it was Pano Tools that achieved the best results due to the additional settings not available in the former tool.
Good luck with your barrel and pincushion distortion corrections!
Please have a look at some of the other correction techniques given in this series.