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. Believe it or not, enough information can be gleaned from the 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 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).

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
Angle
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:

  • Enlarge the section of photo containing the ellipse to maximum
  • Select the Ellipse tool. Set the Ellipse tool options to Paths (second icon in the Window->Options toolbar)
  • Drag the tool to create a circle roughly the size of the ellipse (no need to be accurate yet)
  • Select Edit->Free Transform Path (or Ctrl-T, Windows). In one operation (important), use translate, stretch (vertical and horizontal), and rotate (counter-clockwise) to match the ellipse path to the ellipse in the photograph. Then read the ellipse dimensions and angle from the Information palette (at Windows->Info). If you rotate counter-clockwise, the angle in the Info palette will be -tilt (as defined above); if you went clockwise, tilt = 90 - angle.
  • (The ellipse path is no longer needed and can be deleted)

Next, the tilt of the reference scale's horizontal is easily measured using Photoshop's 'measure' tool (the angle is displayed in the Info panel). 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. Measure from extreme left to right (instead of center to right) for better accuracy.

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

The results are:

  Left clock  Right clock
Vertical rotation (tilt back, degrees)01
Horizontal rotation (tilt right, degrees)-4247
Camera dip (looking down, degrees)-8-7

Close! The verticals should be zero (we presume the clocks are vertical), and the camera dips should be equal (they differ by one degree), and the sum of the horizontal rotations should approach 90 degrees, presuming the tower plan is a regular rectangle viewed from a distance less than infinite (42 + 47 = 89).

Ellipse trivia

  • A circle is just a special-case ellipse where the minor and major axes are the same length.
  • The major axis of an image ellipse is in a plane perpendicular to the line of sight; the minor axis is parallel.
  • The major axis is 'true length' but the minor axis is shorter than 'true' (unless a circle, in which case both are true).
  • Fig 3. Close range, wide-angle photo of disc;
    red lines drawn to show ellipse axes & tilt

    Regardless what lens is used or the distance from which it is photographed, a disc perimeter will always appear as an ellipse (or circle) in a photo. If the angle of line of sight of the camera is not the same across the frame (as is the case except if the photo is taken from infinity), the center of the photographed disc will not match the center of the image ellipse, by an amount that increases inversely with distance and focal length; the disc center will be on the minor axis farther from the camera than the ellipse center. (Figure 3 is a close-up photo taken with a wide-angle lens, with red lines drawn afterwards on the axes of the image ellipse; note the substantial distance between the ellipse center and the disc center.) The two centers will be close when the photo is taken with a telephoto lens (eg., as in the case of figure 2 above). The focal length of the lens can be determined using perspective projection from the distance between the centers.

Comments?