Misplaced Pages

Essential matrix

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
This article may be too technical for most readers to understand. Please help improve it to make it understandable to non-experts, without removing the technical details. (September 2010) (Learn how and when to remove this message)

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

Function

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

( y ) E y = 0 {\displaystyle (\mathbf {y} ')^{\top }\,\mathbf {E} \,\mathbf {y} =0}

if y {\displaystyle \mathbf {y} } and y {\displaystyle \mathbf {y} '} 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 E {\displaystyle \mathbf {E} } 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 E {\displaystyle \mathbf {E} } 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, F {\displaystyle \mathbf {F} } . 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 K {\displaystyle \mathbf {K} } and K {\displaystyle \mathbf {K} '} ) 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

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

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 ( x 1 , x 2 , x 3 ) {\displaystyle (x_{1},x_{2},x_{3})} and ( x 1 , x 2 , x 3 ) {\displaystyle (x'_{1},x'_{2},x'_{3})} relative to each camera's coordinate system. Since the cameras are normalized, the corresponding image coordinates are

( y 1 y 2 ) = 1 x 3 ( x 1 x 2 ) {\displaystyle {\begin{pmatrix}y_{1}\\y_{2}\end{pmatrix}}={\frac {1}{x_{3}}}{\begin{pmatrix}x_{1}\\x_{2}\end{pmatrix}}}   and   ( y 1 y 2 ) = 1 x 3 ( x 1 x 2 ) {\displaystyle {\begin{pmatrix}y'_{1}\\y'_{2}\end{pmatrix}}={\frac {1}{x'_{3}}}{\begin{pmatrix}x'_{1}\\x'_{2}\end{pmatrix}}}

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

( y 1 y 2 1 ) = 1 x 3 ( x 1 x 2 x 3 ) {\displaystyle {\begin{pmatrix}y_{1}\\y_{2}\\1\end{pmatrix}}={\frac {1}{x_{3}}}{\begin{pmatrix}x_{1}\\x_{2}\\x_{3}\end{pmatrix}}}   and   ( y 1 y 2 1 ) = 1 x 3 ( x 1 x 2 x 3 ) {\displaystyle {\begin{pmatrix}y'_{1}\\y'_{2}\\1\end{pmatrix}}={\frac {1}{x'_{3}}}{\begin{pmatrix}x'_{1}\\x'_{2}\\x'_{3}\end{pmatrix}}}

which also can be written more compactly as

y = 1 x 3 x ~ {\displaystyle \mathbf {y} ={\frac {1}{x_{3}}}\,{\tilde {\mathbf {x} }}}   and   y = 1 x 3 x ~ {\displaystyle \mathbf {y} '={\frac {1}{x'_{3}}}\,{\tilde {\mathbf {x} }}'}

where y {\displaystyle \mathbf {y} } and y {\displaystyle \mathbf {y} '} are homogeneous representations of the 2D image coordinates and x ~ {\displaystyle {\tilde {\mathbf {x} }}} and x ~ {\displaystyle {\tilde {\mathbf {x} }}'} 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

x ~ = R ( x ~ t ) {\displaystyle {\tilde {\mathbf {x} }}'=\mathbf {R} \,({\tilde {\mathbf {x} }}-\mathbf {t} )}

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

The essential matrix is then defined as:

E = [ t ] × R {\displaystyle \mathbf {E} =_{\times }\mathbf {R} }

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

For the definition of E {\displaystyle \mathbf {E} } we are only interested in the orientations of the normalized image coordinates (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 E {\displaystyle \mathbf {E} } describes a constraint on corresponding image coordinates multiply E {\displaystyle \mathbf {E} } from left and right with the 3D coordinates of point P in the two different coordinate systems:

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


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

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

0 = ( x ~ ) T E x ~ = 1 x 3 ( x ~ ) T E 1 x 3 x ~ = ( y ) T E y {\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} }

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

Properties

Not every arbitrary 3 × 3 {\displaystyle 3\times 3} 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 3 × 3 {\displaystyle 3\times 3} . 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 E {\displaystyle \mathbf {E} } is multiplied by a non-zero scalar, the result is again an essential matrix which defines exactly the same constraint as E {\displaystyle \mathbf {E} } does. This means that E {\displaystyle \mathbf {E} } 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 E {\displaystyle \mathbf {E} } is estimated from image data. However, it is also possible to take the position that E {\displaystyle \mathbf {E} } is defined as

E = [ t ~ ] × R {\displaystyle \mathbf {E} =_{\times }\,\mathbf {R} }

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

The constraints can also be expressed as

det E = 0 {\displaystyle \det \mathbf {E} =0}

and

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

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 R {\displaystyle \mathbf {R} } and the translation vector t {\displaystyle \mathbf {t} } 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

This section does not cite any sources. Please help improve this section by adding citations to reliable sources. Unsourced material may be challenged and removed. (November 2020) (Learn how and when to remove this message)

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 R {\displaystyle \mathbf {R} } and translation t {\displaystyle \mathbf {t} } (up to a scaling) between the two camera's coordinate systems. In these derivations E {\displaystyle \mathbf {E} } is seen as a projective element rather than having a well-determined scaling.

Finding one solution

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

An SVD of E {\displaystyle \mathbf {E} } gives

E = U Σ V T {\displaystyle \mathbf {E} =\mathbf {U} \,\mathbf {\Sigma } \,\mathbf {V} ^{T}}

where U {\displaystyle \mathbf {U} } and V {\displaystyle \mathbf {V} } are orthogonal 3 × 3 {\displaystyle 3\times 3} matrices and Σ {\displaystyle \mathbf {\Sigma } } is a 3 × 3 {\displaystyle 3\times 3} diagonal matrix with

Σ = ( s 0 0 0 s 0 0 0 0 ) {\displaystyle \mathbf {\Sigma } ={\begin{pmatrix}s&0&0\\0&s&0\\0&0&0\end{pmatrix}}}

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

W = ( 0 1 0 1 0 0 0 0 1 ) {\displaystyle \mathbf {W} ={\begin{pmatrix}0&-1&0\\1&0&0\\0&0&1\end{pmatrix}}}   with   W 1 = W T = ( 0 1 0 1 0 0 0 0 1 ) {\displaystyle \mathbf {W} ^{-1}=\mathbf {W} ^{T}={\begin{pmatrix}0&1&0\\-1&0&0\\0&0&1\end{pmatrix}}}

and make the following ansatz

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

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

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

may help.

Proof

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

[ t ] × R = U W Σ U T U W 1 V T = U Σ V T = E {\displaystyle _{\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} }

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

W Σ = ( 0 s 0 s 0 0 0 0 0 ) {\displaystyle \mathbf {W} \,\mathbf {\Sigma } ={\begin{pmatrix}0&-s&0\\s&0&0\\0&0&0\end{pmatrix}}}

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

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

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

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

Finding all solutions

So far one possible solution for R {\displaystyle \mathbf {R} } and t {\displaystyle \mathbf {t} } has been established given E {\displaystyle \mathbf {E} } . 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 E {\displaystyle \mathbf {E} } is undefined, the scaling of t {\displaystyle \mathbf {t} } is also undefined. It must lie in the null space of E {\displaystyle \mathbf {E} } since

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

For the subsequent analysis of the solutions, however, the exact scaling of t {\displaystyle \mathbf {t} } is not so important as its "sign", i.e., in which direction it points. Let t ^ {\displaystyle {\hat {\mathbf {t} }}} be normalized vector in the null space of E {\displaystyle \mathbf {E} } . It is then the case that both t ^ {\displaystyle {\hat {\mathbf {t} }}} and t ^ {\displaystyle -{\hat {\mathbf {t} }}} are valid translation vectors relative E {\displaystyle \mathbf {E} } . It is also possible to change W {\displaystyle \mathbf {W} } into W 1 {\displaystyle \mathbf {W} ^{-1}} in the derivations of R {\displaystyle \mathbf {R} } and t {\displaystyle \mathbf {t} } 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 E {\displaystyle \mathbf {E} } there are two opposite directions which are possible for t {\displaystyle \mathbf {t} } 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 s > 0 {\displaystyle s>0} 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 R {\displaystyle \mathbf {R} } and t {\displaystyle \mathbf {t} } assumes that E {\displaystyle \mathbf {E} } satisfy the internal constraints of the essential matrix. If this is not the case which, for example, typically is the case if E {\displaystyle \mathbf {E} } has been estimated from real (and noisy) image data, it has to be assumed that it approximately satisfy the internal constraints. The vector t ^ {\displaystyle {\hat {\mathbf {t} }}} is then chosen as right singular vector of E {\displaystyle \mathbf {E} } corresponding to the smallest singular value.

3D points from corresponding image points

Main article: Triangulation (computer vision)

Many methods exist for computing ( x 1 , x 2 , x 3 ) {\displaystyle (x_{1},x_{2},x_{3})} given corresponding normalized image coordinates ( y 1 , y 2 ) {\displaystyle (y_{1},y_{2})} and ( y 1 , y 2 ) {\displaystyle (y'_{1},y'_{2})} , 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.{{cite book}}: CS1 maint: location missing publisher (link)
Category: