Definitions

# Homography

Homography is a concept in the mathematical science of geometry. It is defined as a relation between two figures, such that any given point in one figure corresponds to one and only one point in the other, and vice versa.

### Computer Vision Applications

In the field of computer vision, a homography is defined in 2 dimensional space as a mapping between a point on a ground plane as seen from one camera, to the same point on the ground plane as seen from a second camera. This has many practical applications, most notably it provides a method for compositing 2D or 3D objects into an image or video with the correct pose. The homography matrix is sometimes known as a homograph, a term which has a different meaning in linguistics.

#### 3D plane to plane equation

We have two cameras a and b, looking at points $P_i$ in a plane.

Passing the projections of $P_i$ from $\left\{\right\}^bp_i$ in b to a point $\left\{\right\}^ap_i$ in a:

$\left\{\right\}^ap_i = K_a cdot H_\left\{ba\right\} cdot K_b^\left\{-1\right\} cdot \left\{\right\}^bp_i$

where $H_\left\{ba\right\}$ is

$H_\left\{ba\right\} = R - frac\left\{t n^T\right\}\left\{d\right\}$

$R$ is the rotation matrix by which b is rotated in relation to a; t is the translation vector from a to b; $n$ and $d$ are the normal vector of the plane and the distance to the plane respectively.

$K_a$ and $K_b$ are the cameras' intrinsic parameter matrices.

The figure shows camera b looking at the plane at distance d.

### Mathematical definition

Homogeneous coordinates are used, because matrix multiplication cannot directly perform the division required for perspective projection.

Given:

$p_\left\{a\right\} = begin\left\{bmatrix\right\} x_\left\{a\right\}y_\left\{a\right\}1end\left\{bmatrix\right\}, p^\left\{prime\right\}_\left\{b\right\} = begin\left\{bmatrix\right\} w^\left\{prime\right\}x_\left\{b\right\}w^\left\{prime\right\}y_\left\{b\right\}w^\left\{prime\right\}end\left\{bmatrix\right\}, mathbf\left\{H\right\}_\left\{ab\right\} = begin\left\{bmatrix\right\} h_\left\{11\right\}&h_\left\{12\right\}&h_\left\{13\right\}h_\left\{21\right\}&h_\left\{22\right\}&h_\left\{23\right\}h_\left\{31\right\}&h_\left\{32\right\}&h_\left\{33\right\} end\left\{bmatrix\right\}$
Then:
$p^\left\{prime\right\}_\left\{b\right\} = mathbf\left\{H\right\}_\left\{ab\right\}p_\left\{a\right\}$
where:
$mathbf\left\{H\right\}_\left\{ba\right\} = mathbf\left\{H\right\}_\left\{ab\right\}^\left\{-1\right\}.$
Also:
$p_\left\{b\right\} = p^\left\{prime\right\}_\left\{b\right\}/w^\left\{prime\right\} = begin\left\{bmatrix\right\} x_\left\{b\right\}y_\left\{b\right\}1end\left\{bmatrix\right\}$

### Affine homography

When the image region in which the homography is computed is small or the image has been acquired with a large focal length, an affine homography is a more appropriate model of image displacements. An affine homography is a special type of a general homography whose last row is fixed to $h_\left\{31\right\}=h_\left\{32\right\}=0, ; h_\left\{33\right\}=1$.