Homography (computer vision)

From HandWiki
Short description: Relation of two images with software
Geometrical setup for homography: stereo cameras O1 and O2 both pointed at X in epipolar geometry. Drawing from Neue Konstruktionen der Perspektive und Photogrammetrie by Hermann Guido Hauck (1845 — 1905)

In the field of computer vision, any two images of the same planar surface in space are related by a homography (assuming a pinhole camera model). This has many practical applications, such as image rectification, image registration, or camera motion—rotation and translation—between two images. Once camera resectioning has been done from an estimated homography matrix, this information may be used for navigation, or to insert models of 3D objects into an image or video, so that they are rendered with the correct perspective and appear to have been part of the original scene (see Augmented reality).

3D plane to plane equation

We have two cameras a and b, looking at points [math]\displaystyle{ P_i }[/math] in a plane. Passing from the projection [math]\displaystyle{ {}^bp_i=\left({}^bu_i;{}^bv_i;1\right) }[/math] of [math]\displaystyle{ P_i }[/math] in b to the projection [math]\displaystyle{ {}^ap_i=\left({}^au_i;{}^av_i;1\right) }[/math] of [math]\displaystyle{ P_i }[/math] in a:

[math]\displaystyle{ {}^ap_i = \frac{{}^bz_i}{{}^az_i}K_a \cdot H_{ab} \cdot K_b^{-1} \cdot {}^bp_i }[/math]

where [math]\displaystyle{ {}^az_i }[/math] and [math]\displaystyle{ {}^bz_i }[/math] are the z coordinates of P in each camera frame and where the homography matrix [math]\displaystyle{ H_{ab} }[/math] is given by

[math]\displaystyle{ H_{ab} = R - \frac{t n^T}{d} }[/math].

[math]\displaystyle{ R }[/math] 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 from origin to the plane respectively. Ka and Kb are the cameras' intrinsic parameter matrices.

Homography-transl-bold.svg

The figure shows camera b looking at the plane at distance d. Note: From above figure, assuming [math]\displaystyle{ n^T P_i + d = 0 }[/math] as plane model, [math]\displaystyle{ n^T P_i }[/math] is the projection of vector [math]\displaystyle{ P_i }[/math] along [math]\displaystyle{ n }[/math], and equal to [math]\displaystyle{ -d }[/math]. So [math]\displaystyle{ t = t \cdot 1 = t \left(-\frac{n^TP_i}{d}\right) }[/math]. And we have [math]\displaystyle{ H_{ab} P_i = R P_i + t }[/math] where [math]\displaystyle{ H_{ab} = R - \frac{t n^T}{d} }[/math].

This formula is only valid if camera b has no rotation and no translation. In the general case where [math]\displaystyle{ R_a,R_b }[/math] and [math]\displaystyle{ t_a,t_b }[/math] are the respective rotations and translations of camera a and b, [math]\displaystyle{ R=R_a R_b^T }[/math] and the homography matrix [math]\displaystyle{ H_{ab} }[/math] becomes

[math]\displaystyle{ H_{ab} = R_a R_b^T - \frac{(-R_a * R_b^T * t_b + t_a) n^T}{d} }[/math]

where d is the distance of the camera b to the plane.

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

[math]\displaystyle{ h_{31}=h_{32}=0, \; h_{33}=1. }[/math]

See also

References

Toolboxes

External links