Essential matrix

From HandWiki

In computer vision, the essential matrix is a [math]\displaystyle{ 3 \times 3 }[/math] matrix, [math]\displaystyle{ \mathbf{E} }[/math] that relates corresponding points in stereo images assuming that the cameras satisfy the pinhole camera model.

Function

More specifically, if [math]\displaystyle{ \mathbf{y} }[/math] and [math]\displaystyle{ \mathbf{y}' }[/math] are homogeneous normalized image coordinates in image 1 and 2, respectively, then

[math]\displaystyle{ (\mathbf{y}')^\top \, \mathbf{E} \, \mathbf{y} = 0 }[/math]

if [math]\displaystyle{ \mathbf{y} }[/math] and [math]\displaystyle{ \mathbf{y}' }[/math] correspond to the same 3D point in the scene (not an "if and only if" due to the fact that points that lie on the same epipolar line in the first image will get mapped to the same epipolar line in the second image).

The above relation which defines the essential matrix was published in 1981 by H. Christopher Longuet-Higgins, introducing the concept to the computer vision community. Richard Hartley and Andrew Zisserman's book reports that an analogous matrix appeared in photogrammetry long before that. Longuet-Higgins' paper includes an algorithm for estimating [math]\displaystyle{ \mathbf{E} }[/math] from a set of corresponding normalized image coordinates as well as an algorithm for determining the relative position and orientation of the two cameras given that [math]\displaystyle{ \mathbf{E} }[/math] is known. Finally, it shows how the 3D coordinates of the image points can be determined with the aid of the essential matrix.

Use

The essential matrix can be seen as a precursor to the fundamental matrix, [math]\displaystyle{ \mathbf{F} }[/math]. Both matrices can be used for establishing constraints between matching image points, but the fundamental matrix can only be used in relation to calibrated cameras since the inner camera parameters (matrices [math]\displaystyle{ \mathbf{K} }[/math] and [math]\displaystyle{ \mathbf{K}' }[/math]) must be known in order to achieve the normalization. If, however, the cameras are calibrated the essential matrix can be useful for determining both the relative position and orientation between the cameras and the 3D position of corresponding image points. The essential matrix is related to the fundamental matrix with

[math]\displaystyle{ \mathbf{E} = ({\mathbf{K}'})^{\top} \; \mathbf{F} \; \mathbf{K} . }[/math]

Derivation and definition

This derivation follows the paper by Longuet-Higgins.

Two normalized cameras project the 3D world onto their respective image planes. Let the 3D coordinates of a point P be [math]\displaystyle{ (x_1, x_2, x_3) }[/math] and [math]\displaystyle{ (x'_1, x'_2, x'_3) }[/math] relative to each camera's coordinate system. Since the cameras are normalized, the corresponding image coordinates are

[math]\displaystyle{ \begin{pmatrix} y_1 \\ y_2 \end{pmatrix} = \frac{1}{x_3} \begin{pmatrix} x_1 \\ x_2 \end{pmatrix} }[/math]   and   [math]\displaystyle{ \begin{pmatrix} y'_1 \\ y'_2 \end{pmatrix} = \frac{1}{x'_3} \begin{pmatrix} x'_1 \\ x'_2 \end{pmatrix} }[/math]

A homogeneous representation of the two image coordinates is then given by

[math]\displaystyle{ \begin{pmatrix} y_1 \\ y_2 \\ 1 \end{pmatrix} = \frac{1}{x_3} \begin{pmatrix} x_1 \\ x_2 \\ x_{3} \end{pmatrix} }[/math]   and   [math]\displaystyle{ \begin{pmatrix} y'_1 \\ y'_2 \\ 1 \end{pmatrix} = \frac{1}{x'_3} \begin{pmatrix} x'_1 \\ x'_2 \\ x'_{3} \end{pmatrix} }[/math]

which also can be written more compactly as

[math]\displaystyle{ \mathbf{y} = \frac{1}{x_{3}} \, \tilde{\mathbf{x}} }[/math]   and   [math]\displaystyle{ \mathbf{y}' = \frac{1}{x'_{3}} \, \tilde{\mathbf{x}}' }[/math]

where [math]\displaystyle{ \mathbf{y} }[/math] and [math]\displaystyle{ \mathbf{y}' }[/math] are homogeneous representations of the 2D image coordinates and [math]\displaystyle{ \tilde{\mathbf{x}} }[/math] and [math]\displaystyle{ \tilde{\mathbf{x}}' }[/math] are proper 3D coordinates but in two different coordinate systems.

Another consequence of the normalized cameras is that their respective coordinate systems are related by means of a translation and rotation. This implies that the two sets of 3D coordinates are related as

[math]\displaystyle{ \tilde{\mathbf{x}}' = \mathbf{R} \, (\tilde{\mathbf{x}} - \mathbf{t}) }[/math]

where [math]\displaystyle{ \mathbf{R} }[/math] is a [math]\displaystyle{ 3 \times 3 }[/math] rotation matrix and [math]\displaystyle{ \mathbf{t} }[/math] is a 3-dimensional translation vector.

The essential matrix is then defined as:

[math]\displaystyle{ \mathbf{E} = \mathbf{R} \, [\mathbf{t}]_{\times} }[/math]

where [math]\displaystyle{ [\mathbf{t}]_{\times} }[/math] is the matrix representation of the cross product with [math]\displaystyle{ \mathbf{t} }[/math]. Note: Here, the transformation [math]\displaystyle{ [\mathbf{R}^{T} | \mathbf{t}] }[/math] will transform points in the 2nd view to the 1st view.

For the definition of [math]\displaystyle{ \mathbf{E} }[/math] we are only interested in the orientations of the normalized image coordinates [1] (See also: Triple product). As such we don't need the translational component when substituting image coordinates into the essential equation. To see that this definition of [math]\displaystyle{ \mathbf{E} }[/math] describes a constraint on corresponding image coordinates multiply [math]\displaystyle{ \mathbf{E} }[/math] from left and right with the 3D coordinates of point P in the two different coordinate systems:

[math]\displaystyle{ \tilde{\mathbf{x}}'^{T} \, \mathbf{E} \, \tilde{\mathbf{x}} \, \stackrel{(1)}{=} \,\tilde{\mathbf{x}}^{T} \, \mathbf{R}^{T} \, \mathbf{R} \, [\mathbf{t}]_{\times} \, \tilde{\mathbf{x}} \, \stackrel{(2)}{=} \, \tilde{\mathbf{x}}^{T} \, [\mathbf{t}]_{\times} \, \tilde{\mathbf{x}} \, \stackrel{(3)}{=} \, 0 }[/math]


  1. Insert the above relations between [math]\displaystyle{ \tilde{\mathbf{x}}' }[/math] and [math]\displaystyle{ \tilde{\mathbf{x}} }[/math] and the definition of [math]\displaystyle{ \mathbf{E} }[/math] in terms of [math]\displaystyle{ \mathbf{R} }[/math] and [math]\displaystyle{ \mathbf{t} }[/math].
  2. [math]\displaystyle{ \mathbf{R}^{T} \, \mathbf{R} = \mathbf{I} }[/math] since [math]\displaystyle{ \mathbf{R} }[/math] is a rotation matrix.
  3. Properties of the matrix representation of the cross product.

Finally, it can be assumed that both [math]\displaystyle{ x_{3} }[/math] and [math]\displaystyle{ x'_{3} }[/math] are > 0, otherwise they are not visible in both cameras. This gives

[math]\displaystyle{ 0 = (\tilde{\mathbf{x}}')^{T} \, \mathbf{E} \, \tilde{\mathbf{x}} = \frac{1}{x'_{3}} (\tilde{\mathbf{x}}')^{T} \, \mathbf{E} \, \frac{1}{x_{3}} \tilde{\mathbf{x}} = (\mathbf{y}')^{T} \, \mathbf{E} \, \mathbf{y} }[/math]

which is the constraint that the essential matrix defines between corresponding image points.

Properties

Not every arbitrary [math]\displaystyle{ 3 \times 3 }[/math] matrix can be an essential matrix for some stereo cameras. To see this notice that it is defined as the matrix product of one rotation matrix and one skew-symmetric matrix, both [math]\displaystyle{ 3 \times 3 }[/math]. The skew-symmetric matrix must have two singular values which are equal and another which is zero. The multiplication of the rotation matrix does not change the singular values which means that also the essential matrix has two singular values which are equal and one which is zero. The properties described here are sometimes referred to as internal constraints of the essential matrix.

If the essential matrix [math]\displaystyle{ \mathbf{E} }[/math] is multiplied by a non-zero scalar, the result is again an essential matrix which defines exactly the same constraint as [math]\displaystyle{ \mathbf{E} }[/math] does. This means that [math]\displaystyle{ \mathbf{E} }[/math] can be seen as an element of a projective space, that is, two such matrices are considered equivalent if one is a non-zero scalar multiplication of the other. This is a relevant position, for example, if [math]\displaystyle{ \mathbf{E} }[/math] is estimated from image data. However, it is also possible to take the position that [math]\displaystyle{ \mathbf{E} }[/math] is defined as

[math]\displaystyle{ \mathbf{E} =[\mathbf{\widetilde{t}}]_{\times} \, \mathbf{R} }[/math]

where [math]\displaystyle{ \mathbf{\widetilde{t}} = -\mathbf{R}\mathbf{t} }[/math], and then [math]\displaystyle{ \mathbf{E} }[/math] has a well-defined "scaling". It depends on the application which position is the more relevant.

The constraints can also be expressed as

[math]\displaystyle{ \det \mathbf{E} = 0 }[/math]

and

[math]\displaystyle{ 2 \mathbf{E} \mathbf{E}^T \mathbf{E} - \operatorname{tr} ( \mathbf{E} \mathbf{E}^T ) \mathbf{E} = 0 . }[/math]

Here, the last equation is a matrix constraint, which can be seen as 9 constraints, one for each matrix element. These constraints are often used for determining the essential matrix from five corresponding point pairs.

The essential matrix has five or six degrees of freedom, depending on whether or not it is seen as a projective element. The rotation matrix [math]\displaystyle{ \mathbf{R} }[/math] and the translation vector [math]\displaystyle{ \mathbf{t} }[/math] have three degrees of freedom each, in total six. If the essential matrix is considered as a projective element, however, one degree of freedom related to scalar multiplication must be subtracted leaving five degrees of freedom in total.

Estimation

Given a set of corresponding image points it is possible to estimate an essential matrix which satisfies the defining epipolar constraint for all the points in the set. However, if the image points are subject to noise, which is the common case in any practical situation, it is not possible to find an essential matrix which satisfies all constraints exactly.

Depending on how the error related to each constraint is measured, it is possible to determine or estimate an essential matrix which optimally satisfies the constraints for a given set of corresponding image points. The most straightforward approach is to set up a total least squares problem, commonly known as the eight-point algorithm.

Extracting rotation and translation

Given that the essential matrix has been determined for a stereo camera pair -- for example, using the estimation method above -- this information can be used for determining also the rotation [math]\displaystyle{ \mathbf{R} }[/math] and translation [math]\displaystyle{ \mathbf{t} }[/math] (up to a scaling) between the two camera's coordinate systems. In these derivations [math]\displaystyle{ \mathbf{E} }[/math] is seen as a projective element rather than having a well-determined scaling.

Finding one solution

The following method for determining [math]\displaystyle{ \mathbf{R} }[/math] and [math]\displaystyle{ \mathbf{t} }[/math] is based on performing a SVD of [math]\displaystyle{ \mathbf{E} }[/math], see Hartley & Zisserman's book.[2] It is also possible to determine [math]\displaystyle{ \mathbf{R} }[/math] and [math]\displaystyle{ \mathbf{t} }[/math] without an SVD, for example, following Longuet-Higgins' paper.

An SVD of [math]\displaystyle{ \mathbf{E} }[/math] gives

[math]\displaystyle{ \mathbf{E} = \mathbf{U} \, \mathbf{\Sigma} \, \mathbf{V}^{T} }[/math]

where [math]\displaystyle{ \mathbf{U} }[/math] and [math]\displaystyle{ \mathbf{V} }[/math] are orthogonal [math]\displaystyle{ 3 \times 3 }[/math] matrices and [math]\displaystyle{ \mathbf{\Sigma} }[/math] is a [math]\displaystyle{ 3 \times 3 }[/math] diagonal matrix with

[math]\displaystyle{ \mathbf{\Sigma} = \begin{pmatrix} s & 0 & 0 \\ 0 & s & 0 \\ 0 & 0 & 0 \end{pmatrix} }[/math]

The diagonal entries of [math]\displaystyle{ \mathbf{\Sigma} }[/math] are the singular values of [math]\displaystyle{ \mathbf{E} }[/math] which, according to the internal constraints of the essential matrix, must consist of two identical and one zero value. Define

[math]\displaystyle{ \mathbf{W} = \begin{pmatrix} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix} }[/math]   with   [math]\displaystyle{ \mathbf{W}^{-1} = \mathbf{W}^{T} =\begin{pmatrix} 0 & 1 & 0 \\ -1 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix} }[/math]

and make the following ansatz

[math]\displaystyle{ [\mathbf{t}]_{\times} = \mathbf{U} \, \mathbf{W} \, \mathbf{\Sigma} \, \mathbf{U}^{T} }[/math]
[math]\displaystyle{ \mathbf{R} = \mathbf{U} \, \mathbf{W}^{-1} \, \mathbf{V}^{T} }[/math]

Since [math]\displaystyle{ \mathbf{\Sigma} }[/math] may not completely fulfill the constraints when dealing with real world data (f.e. camera images), the alternative

[math]\displaystyle{ [\mathbf{t}]_{\times} = \mathbf{U} \, \mathbf{Z} \, \mathbf{U}^{T} }[/math]   with   [math]\displaystyle{ \mathbf{Z} = \begin{pmatrix} 0 & 1 & 0 \\ -1 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix} }[/math]

may help.

Proof

First, these expressions for [math]\displaystyle{ \mathbf{R} }[/math] and [math]\displaystyle{ [\mathbf{t}]_{\times} }[/math] do satisfy the defining equation for the essential matrix

[math]\displaystyle{ [\mathbf{t}]_{\times}\,\mathbf{R} = \mathbf{U} \, \mathbf{W} \, \mathbf{\Sigma} \, \mathbf{U}^{T} \mathbf{U} \, \mathbf{W}^{-1} \, \mathbf{V}^{T}\, = \mathbf{U} \, \mathbf{\Sigma} \, \mathbf{V}^{T} = \mathbf{E} }[/math]

Second, it must be shown that this [math]\displaystyle{ [\mathbf{t}]_{\times} }[/math] is a matrix representation of the cross product for some [math]\displaystyle{ \mathbf{t} }[/math]. Since

[math]\displaystyle{ \mathbf{W} \, \mathbf{\Sigma} = \begin{pmatrix} 0 & -s & 0 \\ s & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix} }[/math]

it is the case that [math]\displaystyle{ \mathbf{W} \, \mathbf{\Sigma} }[/math] is skew-symmetric, i.e., [math]\displaystyle{ (\mathbf{W} \, \mathbf{\Sigma})^{T} = - \mathbf{W} \, \mathbf{\Sigma} }[/math]. This is also the case for our [math]\displaystyle{ [\mathbf{t}]_{\times} }[/math], since

[math]\displaystyle{ ([\mathbf{t}]_{\times})^{T} = \mathbf{U} \, (\mathbf{W} \, \mathbf{\Sigma})^{T} \, \mathbf{U}^{T} = - \mathbf{U} \, \mathbf{W} \, \mathbf{\Sigma} \, \mathbf{U}^{T} = - [\mathbf{t}]_{\times} }[/math]

According to the general properties of the matrix representation of the cross product it then follows that [math]\displaystyle{ [\mathbf{t}]_{\times} }[/math] must be the cross product operator of exactly one vector [math]\displaystyle{ \mathbf{t} }[/math].

Third, it must also need to be shown that the above expression for [math]\displaystyle{ \mathbf{R} }[/math] is a rotation matrix. It is the product of three matrices which all are orthogonal which means that [math]\displaystyle{ \mathbf{R} }[/math], too, is orthogonal or [math]\displaystyle{ \det(\mathbf{R}) = \pm 1 }[/math]. To be a proper rotation matrix it must also satisfy [math]\displaystyle{ \det(\mathbf{R}) = 1 }[/math]. Since, in this case, [math]\displaystyle{ \mathbf{E} }[/math] is seen as a projective element this can be accomplished by reversing the sign of [math]\displaystyle{ \mathbf{E} }[/math] if necessary.

Finding all solutions

So far one possible solution for [math]\displaystyle{ \mathbf{R} }[/math] and [math]\displaystyle{ \mathbf{t} }[/math] has been established given [math]\displaystyle{ \mathbf{E} }[/math]. It is, however, not the only possible solution and it may not even be a valid solution from a practical point of view. To begin with, since the scaling of [math]\displaystyle{ \mathbf{E} }[/math] is undefined, the scaling of [math]\displaystyle{ \mathbf{t} }[/math] is also undefined. It must lie in the null space of [math]\displaystyle{ \mathbf{E} }[/math] since

[math]\displaystyle{ \mathbf{E} \, \mathbf{t} = \mathbf{R} \, [\mathbf{t}]_{\times} \, \mathbf{t} = \mathbf{0} }[/math]

For the subsequent analysis of the solutions, however, the exact scaling of [math]\displaystyle{ \mathbf{t} }[/math] is not so important as its "sign", i.e., in which direction it points. Let [math]\displaystyle{ \hat{\mathbf{t}} }[/math] be normalized vector in the null space of [math]\displaystyle{ \mathbf{E} }[/math]. It is then the case that both [math]\displaystyle{ \hat{\mathbf{t}} }[/math] and [math]\displaystyle{ -\hat{\mathbf{t}} }[/math] are valid translation vectors relative [math]\displaystyle{ \mathbf{E} }[/math]. It is also possible to change [math]\displaystyle{ \mathbf{W} }[/math] into [math]\displaystyle{ \mathbf{W}^{-1} }[/math] in the derivations of [math]\displaystyle{ \mathbf{R} }[/math] and [math]\displaystyle{ \mathbf{t} }[/math] above. For the translation vector this only causes a change of sign, which has already been described as a possibility. For the rotation, on the other hand, this will produce a different transformation, at least in the general case.

To summarize, given [math]\displaystyle{ \mathbf{E} }[/math] there are two opposite directions which are possible for [math]\displaystyle{ \mathbf{t} }[/math] and two different rotations which are compatible with this essential matrix. In total this gives four classes of solutions for the rotation and translation between the two camera coordinate systems. On top of that, there is also an unknown scaling [math]\displaystyle{ s \gt 0 }[/math] for the chosen translation direction.

It turns out, however, that only one of the four classes of solutions can be realized in practice. Given a pair of corresponding image coordinates, three of the solutions will always produce a 3D point which lies behind at least one of the two cameras and therefore cannot be seen. Only one of the four classes will consistently produce 3D points which are in front of both cameras. This must then be the correct solution. Still, however, it has an undetermined positive scaling related to the translation component.

The above determination of [math]\displaystyle{ \mathbf{R} }[/math] and [math]\displaystyle{ \mathbf{t} }[/math] assumes that [math]\displaystyle{ \mathbf{E} }[/math] satisfy the internal constraints of the essential matrix. If this is not the case which, for example, typically is the case if [math]\displaystyle{ \mathbf{E} }[/math] has been estimated from real (and noisy) image data, it has to be assumed that it approximately satisfy the internal constraints. The vector [math]\displaystyle{ \hat{\mathbf{t}} }[/math] is then chosen as right singular vector of [math]\displaystyle{ \mathbf{E} }[/math] corresponding to the smallest singular value.

3D points from corresponding image points

Main page: Triangulation (computer vision)

Many methods exist for computing [math]\displaystyle{ (x_{1}, x_{2}, x_{3}) }[/math] given corresponding normalized image coordinates [math]\displaystyle{ (y_{1}, y_{2}) }[/math] and [math]\displaystyle{ (y'_{1}, y'_{2}) }[/math], if the essential matrix is known and the corresponding rotation and translation transformations have been determined.

See also

Toolboxes

External links

References

  1. Photogrammetric Computer Vision: Statistics, Geometry, Orientation and Reconstruction (1st ed.). 
  2. Hartley, Richard; Andrew Zisserman (2004). Multiple view geometry in computer vision (2nd ed.). Cambridge, UK. ISBN 978-0-511-18711-7. OCLC 171123855.