Perspective correction

From PanoTools.org Wiki
Revision as of 22:27, 25 July 2005 by Erik Krause (Talk)

Jump to: navigation, search

Contents

Intro

This tutorial has no direct relevance to panorama creation. However, perspective correction is an issue for panorama creation as well, if you shoot your images tilted up or down. But please note that it is not necessary to correct the images prior to stitching - this is done in one go with alignment and stitching.

Falling lines can be annoying not only in architectural photography. In former times photographers used shift lenses (some times called Perspective Correction lenses) to correct for that. These lenses usually are pretty expensive, not available in all needed focal lengths and limited to a certain amount of correction.

Panotools are able to simulate a shift lens in terms of geometry (obviously they can't simulate it in terms of Depth of Field). There are some easy and straightforward techniques to achieve perspective correction depending on the direction the camera was tilted.

Prerequisites

This tutorial uses PTGui, but any of the GUI front-ends would do. The usage of these programs is more or less identical although names differ sometimes a bit and some fields are in different locations. For hugin there is a similar tutorial here: [1]

In all cases you start a new project and add the image you want to correct by pressing the Add button.

Go to Lens parameters tab and choose your lens type (presumable normal (rectilinear)). Enter the approximate Field of View if not already read from EXIF data (it's not necessary to have it exact). If you already have lens correction parameters enter them in the a, b and c fields else enter 0.0 for each.

In Panorama settings tab choose Rectilinear ('flat') as output.

Camera tilted up or down

Camera level to the horizon

Falling lines example © Daniela D�rbeck
corrected image in Panorama Editor

If the camera was level to the horizon, one pair of vertical control points is enough to correct for falling lines. Go to Control points tab and set one point to the top of something vertical in your image in the left pane and one point at the bottom of the same vertical structure in the rigth pane. Be sure to choose Vertical line as control point type.

On Optimizer tab check Interface: Advanced. Check Pitch and Use control points of: for Image 0. All other fields are unchecked. Then press Run Optimizer and confirm the following dialog.

Once you're done proceed as described under Adjust output.

In the example image I set one point at the middle light at the top of the tower, another approximately in the middle as far down as possible. Click the thumbs to enlarge.

Camera rotated

Falling lines example 2 © Erik Krause
Image in Control Point Editor
Corrected image in Panorama Editor

If the camera was rotated you need at least two vertical lines control point pairs. Go to Control points tab and set two point pairs on some vertical structures well apart from each other. For each line set a point in one pane at the bottom and in the other pane at the top of the same vertical structure. Be sure to choose Vertical line as control point type.

In order to correct for perspective and image rotation you must optimize Pitch and Roll.

On Optimizer tab check Interface: Advanced. Check Pitch Roll and Use control points of: for Image 0. All other fields are unchecked. Then press Run Optimizer and confirm the following dialog.

Once you're done proceed as described under Adjust output.

In the example image I set one point pair at top and bottom of the leftmost edge of the altar and one point pair at the rightmost edge. Click the thumbs to enlarge.

Adjust output

In any case the image will be shifted in some direction, hence the output image will be larger. The width and heigth of the output image can be adjusted, but it is not possible to crop either side individually in PTGui.

Open Panorama Editor (Ctrl+E) and press the Fit panorama (Ctrl+F or menu: Edit -> Fit panorama) button. This will automatically adjust the output area to fit the corrected image.

You should see the image shifted in some direction with the empty space filled with black. You can adjust the width and heigth of the frame using the small sliders at the bottom and right side of the window (actually you adjust the output Field of View). The additional black space must be cropped in some image editor.


(to be continued)


--Erik Krause 18:38, 23 Jul 2005 (EDT)

Personal tools
Namespaces

Variants
Actions
Navigation
tools
Tools