Perspective Correction

Back to reference scale page

Fig 1. Reference scale on a windshield

To the right is a photo of the reference scale resting on a car windshield. Enough information can be gleaned from that image of the reference scale to determine the tilt of the windshield (56°) and the angle of view of the camera (it was 52° off to the right, and looking down at 38°).

When photographed obliquely, the circular target on the reference scale will appear in photos as an ellipse. Parameters of the ellipse alone provide enough information to determine the angle between the camera's view and the axis of the disc on the reference scale. Furthermore, if the horizontal axis of the perspective disc on the reference scale was aligned to horizontal (ie., was level), and the camera was also horizontal (level, though possibly angled looking down or up), it's possible to deduce the angles of rotation (horizontal and vertical) of the disc in the real world with respect to the ground, and the angle by which the camera was pointing down or up. The derivation of this is somewhat involved, but the resulting formulae are easily applied by a computer -- the form below calculates the three angles, given information about the ellipse in a photo.

Fig 2. Fig 1, measured

The accuracy of this method depends on good measurements of the ellipse (easy, using the method outlined below) and the reference scale and camera having been level. Sensitivity improves as the disc is viewed further off-axis (whereas a reference scale with a pole mounted on the disc axis would be sensitive near-axis). Photographs are assumed by the form below to have been taken from 'infinity' (reasonably approximated by using a telephoto lens; information from the disc image can be used to determine whether a telephoto lens was used; see Ellipse trivia below).

Measurements of the reference scale in figure 1 (upper right) on a car windshield are shown in figure 2 and have been pre-entered into the form below -- press the 'Compute angles' button to find the angles. (Answer: The reference scale, and thus the windshield, tilts back 56 degrees, which agrees well with an inclinometer reading of 55 degrees. In addition, the camera is looking at the reference scale from 52 degrees to the right, and is looking down 38 degrees.)

Calculate angles between disc and camera's view

The more information you enter below about the ellipse, the more rotations can be calculated. This form assumes the photo was taken using a telephoto lens (see Ellipse trivia for how to tell). The form is pre-loaded, as an example, with information from figure 2 above. Press 'Compute angles', or 'Clear form' and then enter your info.

OneMinor axis length (any units of length)
Major axis length
TwoTilt of major axis (degrees clockwise), relative to the image vertical, from "12 o'clock" (-90 to 90; 0 = no tilt)
ThreeTilt of horizontal (degrees clockwise), relative to the camera horizontal, from "3 o'clock" (-90 to 90; 0 = no tilt)
One rotationTwo rotationsThree rotations
Reference frame:
Camera line of sight
Reference frame:
Camera frame
Reference frame:
Real world
Minor:major = 1.0
Vertical rotation
(top pushed back)
Horizontal rotation
(right pushed back)
Vertical rotation
(top pushed back)
Horizontal rotation
(right pushed back)
Camera dip
(looking down)

(If this form makes an error, please send me a note including the values entered.)

Measuring the ellipse in a photo that includes the reference scale

Photoshop can be used to obtain the major/minor axes lengths and tilt from an image by matching an ellipse path generated by Photoshop to one in a photograph -- I find this more accurate than 'eyeballing' it. Here's the procedure I use with Photoshop:

Next, the tilt of the reference scale's horizontal is easily measured using Photoshop's 'ruler' tool (the angle of a ruler line with respect to horizontal is displayed in the Info panel and on the options bar). If you measure left to right, the angle displayed by Photoshop will be relative to horizontal and negative -- convert that to positive for 'tilt of scale' in the form above. For better accuracy, measure your ellipse from its extreme left to right (instead of its center to right).

Ellipses 'in the wild'

Sometimes there are circles 'in the wild' with horizontals marked, such as the clock faces in the photo below, of London's Big Ben clock tower. The two clocks in the right-most image have been marked up using Photoshop with the ellipses (red), their major axis (white), and the horizontal (green).

The measurements are as follows:

  Left clock  Right clock
Minor axis (length, pixels)6358
Major axis (length, pixels)8686
Tilt of major axis (degrees clockwise)8-7
Tilt of horizontal (degrees clockwise)-77

Entering those measurements in the form above, the results and expectations are:

  Left clock  Right clock  As expected?
Vertical rotation (tilt back, degrees)01✔ (0)
Horizontal rotation (tilt right, degrees)-4247✔ (differ by ~90°)
Camera dip (looking down, degrees)-8-7✔ (equal and negative)

The verticals should be zero (assuming the clock faces are vertical), and the camera dips should be equal (because we are looking at both at the same angle) and negative (because we are looking upwards at them), and the sum of the horizontal rotations should approach but not reach 90 degrees (presuming the tower plan is a regular rectangle, and is viewed from a less-than-infinite distance).

The results are close to expectations.

Ellipse trivia