Skip to content

Vancouver at Dusk by Randy Kosek.

Perfectly square

How to make a rectangular object perfectly square using the panotools:

In this example the frame is straight, but somehow the photo looks distorted.

The camera (film/sensor) was not exactly parallel to the object during the exposure
and resulted in a slightly skewed frame along with some distortions (bowed lines)
caused by the lens:

This can easily be fixed with the panotools: start with vertical and horizontal control points.
For this I'm using the PTGui software. Note: by default t1 points (vertical line) are selected.
Change horizontal control points to the t2 type.

It is important to align vertical and horizontal control points not only at the
corner points but also in the middle of the sides.
Any camera lens has a distortion and lines are not straight. Using the middle
points will fix those bows too.

Make sure the lens type is rectilinear:

And the projection is set to rectilinear:

Select Raw, Pitch and Roll and run the first optimization.
It is important not to select all variables at once: optimization is finding
a low spot in a multidimensional field and optimizing for Raw, Pitch and Roll
first you make sure not to optimize on a local spot in a wrong location.

The first result looks good and corners are aligned correctly. Now we fix the bowed lines.

Add the Field of View, b and vert/horz shift.
Do not use a, b and c altogether. Just the b parameter is
perfectly suited for the non-wavy camera lens distortions.
The optimizer can now calculate the exact parameter values:

The object is now straitened:

The panotools take all the calculated parameters and create the final output image:

Perfectly square:

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Perfectly square

Thanks, very interesting.
I'll have to try this ...

Jürgen Schrader
IVRPA Director


Re: Perfectly square

Thank you Jürgen!
what you described works much better than Photoshop lens correction..

Markus Krüger