Perspective Rectification

A. Fusiello


⚠ Disambiguation

The word rectification alone is used in the fields of Computer Vision, Photogrammetry and Image processing with several different meanings. For this reason I shall precede it with an adjective in order to disambiguate. This page is about perspective rectification, i.e., the removal of perspective effects on a single image, a.k.a. perspective control, or correction. The page for epipolar rectification that operates on a stereo pair and makes it amenable to stereo matching is here .


Description

Perspective rectification transforms the original image with a homography such that the image of a reference plane chosen by the user becomes a similarity transform of the real one (instead of a perspective projection). As a result:

The reference plane typically is the ground or a facade. As emphasized above, the similarity is valid only for the reference plane. The image of all the other object points (excluding other planes parallel to the reference one) is distorted. This rectified (or controlled) photo is not the same as an orthophoto(*). The user can provide input in two ways:

  1. Select 4 pair of points that determine 4 lines (two horizontal and two vertical). The distance between pair of lines can be given in order to scale the image correctly.
  2. Select 4 points on a rectangle. The dimensions of the rectangle can be given in order to scale the image correctly.

In any case horizontal and vertical scales are guessed, so that a default is submitted to the user that does not have access to any measure. An independent scaling of the two axes can be easily applied also a-posteriori.


Code

The MATLAB Perspective Rectification Toolkit is based on functions contained in the MATLAB  Computer Vision Toolkit by A. Fusiello. The code does not have any other external dependency on toolboxes or packages, and runs indifferently on Octave and Matlab. It has been tested on Octave 4.2.1 and Matlab R2017a.


References

Reference [1] is the oldest one on this subject that I could find. The PDF is unavailable, but the subsequent paper by the same author [2] -- which is indeed available -- summarizes some contents of the previous one.
  1. H.P. Baehr (Bähr). Digital Rectification of a Facade. Presented paper, ISP Commission III Symposium, Moscow, 1978
  2. H.P. Baher (Bähr). Analog Versus Digital Image Processing of Photogrammetric Imagery. XVI Congress of ISPRS, Commission III, Hamburg 1980

(*) An orthophoto is a synthetic (rendered) orthographic image, and its creation entails the knowledge of the structure of the imaged object (i.e., the depth of all the points).