image distortion and perspective
Step by step description of a method to correct image distortion
and perspective using Panorama
Tools and PTgui
Photographed with Coolpix 990 + wide angle
There are two common problems when shooting
Both defaults can be corrected in a single (though
lengthy!) operation using Panorama Tools and PTgui. The procedure
described below seems long and complicated, but this is because
I tried to detail each step.
Read also "Correcting
Barrel Distortion" by Helmut Dersch.
June 2002 update :
Erik Krause has written a tutorial on a slightly different method
to correct distortion, see it here.
do I need ?
Source images tab:
- Click on Add button, select your image and press
- Click Next
Lens settings tab:
- Select Normal lens type
- Insert Focal of your lens or its horizontal
field of view - exact value is not critical
- Set all lens corrections parameters (a, b and
c) to 0.001 (default value). Of course if you have
better startup values from a previous work or lens
calibration, use these values
- Click Next
Panorama settings tab:
- Select Rectilinear projection
- Set field of view to about 20% more than fov
of your original image
- ... and image dimensions 20% bigger than original
- Select your prefered image format
- Click Next (no cropping needed)
Image parameters tab:
- Set initial orientation angles of your image
(yaw, pitch and roll) to 0
- Click Next
Control points tab: (CP =control point)
- Verify that CP type is "align horizontally".
As you have only one image, this should be the default
option. The image will be transformed such that
the horizontal distance of the CP is minimized.
This CP type define points that should be on the
same vertical line in the final panorama.
- Auto-add : if you use only mouse to position
your cursor over CP, you should not use auto-add
as the CP will be validated as soon as you click
on the second image, and it is easy to move accidentally.
I use a mixed mouse/keyboard strategy: position
mouse approximatively and fine tune using keyboard
(use Alt-arrows to move, Alt-enter to mark CP).
Auto-add is then fine...
- On left image, select a point at bottom of a
clearly defined vertical line (3a), then on right
image mark a point at top of the SAME vertical (3b).
- Do the same between bottom and middle of another
vertical (4a, 4b). (this will help to fix barrel
distortion). Go on with a few vertical lines scattered
on the image (I used 7 CP on this one)
- Click Next
- Check Advanced interface
- Check the optimisation of Roll and Pitch (Roll
is the angle of the camera around lens axis, Pitch
is the angle of this axis with horizontal plane)
- Check all three lens distortion parameters (if
you have few vertical lines in your image and couldn't
set enough CP, check only b parameter and set a=c=0
in lens settings tab
- Click Run Optimizer
After a short time, this windows opens. If you made
no mistake while placing your CPs you should have a
"This is good" message or even better.
Note: this kind of optimisation problem generally
has a lot of solutions, don't worry if you get different
values for a/b/c when you modify startup values. Getting
consistent values requires extensive lens calibration
(see for example Big
Ben's Panorama Tutorials)
Now come back to image parameters tab:
- The thumbnail has been updated to reflect pitch
and roll correction (but not lens distortion correction).
You may verify that your photo fits in the corrected
image. If - as it is the case here - the camera
was heavily tilted, it will be cropped and you have
to enlarge generated image.
- To do that, go to Panorama Settings tab. If
your photo doesn't fit in vertical direction, increase
- If it doesn't fit in horizontal direction, increase
horizontal field of view (Panorama Tools always
resize image so that given hfov spans all horizontal
size). As your image gets shrunk when you increase
hfov, you may want to increase horizontal size too.
- As you modify panorama settings you may control
your image using PTgui panorama editor (enable/disable
it in <Window> menu)
Last step... go to Create Panorama tab, and click
on Create button... That's it, you only have to
Download these elements to try yourself:
(create panorama) script
For more details and examples, goto part