﻿ The Homography transformation
 The Homography transformation - Basic Concepts The Homography transformation is a popular geo-referencing technique used worldwide. It is based on quite complex geometric and mathematic concepts, known as “homogeneous coordinates” and “projective planes”, the explanation of which is of course not within the scope of this guide. Just to give an idea, the familiar Cartesian plane is composed by a set of points which have a one-to-one correlation to pairs of real numbers, i.e. X-Y on the two axis. The “projective plane” instead is a superset of that real plane where for each point we also consider all possible (infinite) straight lines towards space. In this scenario every 2D point can be projected in any other plane in the space. Based on these concepts, it is defined by the “homography between 2 planes” which, simply speaking, means that given 4 points in a plane, there always exists a relationship that transforms them into the corresponding 4 points in another plane. As shown in Fig. BC.H1, this relationship is then used in normal geometry as it allows you to transform a quadrilateral in one reference system into the corresponding quadrilateral in another reference system. Fig. BC.H1 – The homography transforms a quadrilateral from one reference system into the corresponding quadrilateral in another reference system.   Initially the homography has not been used for map geo-referencing but for other purposes, such as to rectify a perspective image, for example to generate a “plan” view of a building from a “perspective” photo. Fig. BC.H2 shows this concept: the image on the right is a plan view of some orthogonal rectangles, whereas the image on the left is a perspective view. Fig. BC.H2 – The perspective-to-plane transformation performed by means of homography.   The homography transformation has been extended to maps when aerial photography techniques has been used. In this type of survey the homography is used by assuming the map as a perspective view of the ground as shown in Fig. BC.H3. Fig. BC.H3 – The perspective-to-plane transformation performed by means of homography.   The algorithm The homography transformation is based on the following formulae: Where X-Y are the coordinates to be calculated in the second reference system, given coordinates x-y in the first reference system in function of 8 transformation parameters a, b, c, d, e, f, g, h. So, having these 8 unknowns, at least 4 known points in both systems are required, this is why we previously mentioned "quadrilaterals". The formulae above are then transformed in non-fractional equations by multiplying both terms by the denominator: Hence: And: Hence: Writing now these equations for the 4 known points in both reference systems (indicated with indexes 1, 2, 3, 4):  We can finally write the transformation matrix that allows us to calculate the 8 transformation parameters, which is described below. a = fixed scale factor in X direction with scale Y unchanged. b = scale factor in X direction proportional to Y distance from origin. c = origin translation in X direction. d = scale factor in Y direction proportional to X distance from origin. e = fixed scale factor in Y direction with scale X unchanged. f = origin translation in Y direction. g = proportional scale factors X and Y in function of X. h = proportional scale factors X and Y in function of Y.   Once calculated, these 8 parameters can easily be used to transform any point from the first reference system to the second using the transformation formulae at the beginning of this section.   In the Transformations | Homography section you'll find the explanation how to apply this transformation with CorrMap. The irresolvable case Unfortunately the Homography and Rubber-Sheeting algorithms present an irresolvable case which arises when a quadrilateral has 3 vertices nearly aligned as shown in Fig. BC.H4 (in which the misalignment is exaggerated to make it evident). In this case, in fact, the matrix calculation described above is not possible (matrix not invertible). This is an additional reason to use the Trilateral transformation (which does not have unresolvable cases), other than the conceptual reasons discussed in section Basic Concepts | Trilateral. Fig. BC.H4 – The Homography and Rubber-Sheeting algorithms fail when 3 vertices of a quadrilateral are nearly aligned.