Eight-point Algorithm
   HOME

TheInfoList



OR:

The eight-point algorithm is an algorithm used in
computer vision Computer vision is an interdisciplinary scientific field that deals with how computers can gain high-level understanding from digital images or videos. From the perspective of engineering, it seeks to understand and automate tasks that the hum ...
to estimate the
essential matrix In computer vision, the essential matrix is a 3 \times 3 matrix, \mathbf that relates corresponding points in stereo images assuming that the cameras satisfy the pinhole camera model. Function More specifically, if \mathbf and \mathbf' ar ...
or the fundamental matrix related to a stereo camera pair from a set of corresponding image points. It was introduced by Christopher Longuet-Higgins in 1981 for the case of the essential matrix. In theory, this algorithm can be used also for the fundamental matrix, but in practice the normalized eight-point algorithm, described by Richard Hartley in 1997, is better suited for this case. The algorithm's name derives from the fact that it estimates the essential matrix or the fundamental matrix from a set of eight (or more) corresponding image points. However, variations of the algorithm can be used for fewer than eight points.


Coplanarity constraint

One may express the
epipolar geometry Epipolar geometry is the geometry of stereo vision. When two cameras view a 3D scene from two distinct positions, there are a number of geometric relations between the 3D points and their projections onto the 2D images that lead to constraints b ...
of two cameras and a point in space with an algebraic equation. Observe that, no matter where the point P is in space, the vectors \overline, \overline and \overline belong to the same plane. Call X_L the coordinates of point P in the left eye's reference frame and call X_R the coordinates of P in the right eye's reference frame and call R, T the rotation and translation between the two reference frames s.t. X_R = R (X_L-T) is the relationship between the coordinates of P in the two reference frames. The following equation always holds because the vector generated from T \wedge X_L is orthogonal to both T and X_L : : X_L^T T \wedge X_L - T^T T \wedge X_L = (X_L-T)^T T \wedge X_L = 0 Because I = R^T R , we get : (X_L-T)^T R^T R T \wedge X_L = 0 . Replacing (X_L-T)^TR^T with X_R^T, we get : X_R^T R T \wedge X_L = X_R^T R S X_L = X_R^T E X_L = 0 Observe that T \wedge may be thought of as a matrix; Longuet-Higgins used the symbol S to denote it. The product R T \wedge = R S is often called
essential matrix In computer vision, the essential matrix is a 3 \times 3 matrix, \mathbf that relates corresponding points in stereo images assuming that the cameras satisfy the pinhole camera model. Function More specifically, if \mathbf and \mathbf' ar ...
and denoted with E . The vectors \overline, \overline are parallel to the vectors \overline, \overline and therefore the coplanarity constraint holds if we substitute these vectors. If we call y, y' the coordinates of the projections of P onto the left and right image planes, then the coplanarity constraint may be written as : y'^T \mathbf y = 0


Basic algorithm

The basic eight-point algorithm is here described for the case of estimating the essential matrix \mathbf . It consists of three steps. First, it formulates a
homogeneous linear equation In mathematics, a system of linear equations (or linear system) is a collection of one or more linear equations involving the same variables. For example, :\begin 3x+2y-z=1\\ 2x-2y+4z=-2\\ -x+\fracy-z=0 \end is a system of three equations in the ...
, where the solution is directly related to \mathbf , and then solves the equation, taking into account that it may not have an exact solution. Finally, the internal constraints of the resulting matrix are managed. The first step is described in Longuet-Higgins' paper, the second and third steps are standard approaches in estimation theory. The constraint defined by the essential matrix \mathbf is : (\mathbf')^ \, \mathbf \, \mathbf = 0 for corresponding image points represented in normalized image coordinates \mathbf, \mathbf' . The problem which the algorithm solves is to determine \mathbf for a set of matching image points. In practice, the image coordinates of the image points are affected by noise and the solution may also be over-determined which means that it may not be possible to find \mathbf which satisfies the above constraint exactly for all points. This issue is addressed in the second step of the algorithm.


Step 1: Formulating a

homogeneous linear equation In mathematics, a system of linear equations (or linear system) is a collection of one or more linear equations involving the same variables. For example, :\begin 3x+2y-z=1\\ 2x-2y+4z=-2\\ -x+\fracy-z=0 \end is a system of three equations in the ...

With : \mathbf = \begin y_ \\ y_ \\ 1 \end   and   \mathbf' = \begin y'_ \\ y'_ \\ 1 \end   and   \mathbf = \begin e_ & e_ & e_ \\ e_ & e_ & e_ \\ e_ & e_ & e_ \end the constraint can also be rewritten as : y'_1 y_1 e_ + y'_1 y_2 e_ + y'_1 e_ + y'_2 y_1 e_ + y'_2 y_2 e_ + y'_2 e_ + y_1 e_ + y_2 e_ + e_ = 0 \, or : \mathbf \cdot \tilde = 0 where : \tilde = \begin y'_1 y_1 \\ y'_1 y_2 \\ y'_1 \\ y'_2 y_1 \\ y'_2 y_2 \\ y'_2 \\ y_1 \\ y_2 \\ 1 \end   and   \mathbf = \begin e_ \\ e_ \\ e_ \\ e_ \\ e_ \\ e_ \\ e_ \\ e_ \\ e_ \end that is, \mathbf represents the essential matrix in the form of a 9-dimensional vector and this vector must be orthogonal to the vector \tilde which can be seen as a vector representation of the 3 \times 3 matrix \mathbf' \, \mathbf^ . Each pair of corresponding image points produces a vector \tilde . Given a set of 3D points \mathbf_k this corresponds to a set of vectors \tilde_ and all of them must satisfy : \mathbf \cdot \tilde_ = 0 for the vector \mathbf . Given sufficiently many (at least eight) linearly independent vectors \tilde_ it is possible to determine \mathbf in a straightforward way. Collect all vectors \tilde_ as the columns of a matrix \mathbf and it must then be the case that : \mathbf^ \, \mathbf = \mathbf This means that \mathbf is the solution to a
homogeneous linear equation In mathematics, a system of linear equations (or linear system) is a collection of one or more linear equations involving the same variables. For example, :\begin 3x+2y-z=1\\ 2x-2y+4z=-2\\ -x+\fracy-z=0 \end is a system of three equations in the ...
.


Step 2: Solving the equation

A standard approach to solving this equation implies that \mathbf is a right singular vector of \mathbf corresponding to a
singular value In mathematics, in particular functional analysis, the singular values, or ''s''-numbers of a compact operator T: X \rightarrow Y acting between Hilbert spaces X and Y, are the square roots of the (necessarily non-negative) eigenvalues of the self- ...
that equals zero. Provided that at least eight linearly independent vectors \tilde_ are used to construct \mathbf it follows that this singular vector is unique (disregarding scalar multiplication) and, consequently, \mathbf and then \mathbf can be determined. In the case that more than eight corresponding points are used to construct \mathbf it is possible that it does not have any singular value equal to zero. This case occurs in practice when the image coordinates are affected by various types of noise. A common approach to deal with this situation is to describe it as a
total least squares In applied statistics, total least squares is a type of errors-in-variables regression, a least squares data modeling technique in which observational errors on both dependent and independent variables are taken into account. It is a generaliza ...
problem; find \mathbf which minimizes : \, \mathbf^ \, \mathbf \, when \, \mathbf \, = 1 . The solution is to choose \mathbf as the left singular vector corresponding to the ''smallest'' singular value of \mathbf . A reordering of this \mathbf back into a 3 \times 3 matrix gives the result of this step, here referred to as \mathbf_ .


Step 3: Enforcing the internal constraint

Another consequence of dealing with noisy image coordinates is that the resulting matrix may not satisfy the internal constraint of the essential matrix, that is, two of its singular values are equal and nonzero and the other is zero. Depending on the application, smaller or larger deviations from the internal constraint may or may not be a problem. If it is critical that the estimated matrix satisfies the internal constraints, this can be accomplished by finding the matrix \mathbf' of rank 2 which minimizes : \, \mathbf' - \mathbf_ \, where \mathbf_ is the resulting matrix from Step 2 and the Frobenius matrix norm is used. The solution to the problem is given by first computing a
singular value decomposition In linear algebra, the singular value decomposition (SVD) is a factorization of a real or complex matrix. It generalizes the eigendecomposition of a square normal matrix with an orthonormal eigenbasis to any \ m \times n\ matrix. It is related ...
of \mathbf_ : : \mathbf_ = \mathbf \, \mathbf \, \mathbf^ where \mathbf, \mathbf are orthogonal matrices and \mathbf is a diagonal matrix which contains the singular values of \mathbf_ . In the ideal case, one of the diagonal elements of \mathbf should be zero, or at least small compared to the other two which should be equal. In any case, set : \mathbf' = \begin s_1 & 0 & 0 \\ 0 & s_2 & 0 \\ 0 & 0 & 0 \end , where s_1, s_2 are the largest and second largest singular values in \mathbf respectively. Finally, \mathbf' is given by : \mathbf' = \mathbf \, \mathbf' \, \mathbf^ The matrix \mathbf' is the resulting estimate of the essential matrix provided by the algorithm.


Normalized algorithm

The basic eight-point algorithm can in principle be used also for estimating the fundamental matrix \mathbf . The defining constraint for \mathbf is : (\mathbf')^ \, \mathbf \, \mathbf = 0 where \mathbf, \mathbf' are the homogeneous representations of corresponding image coordinates (not necessary normalized). This means that it is possible to form a matrix \mathbf in a similar way as for the essential matrix and solve the equation : \mathbf^ \, \mathbf = \mathbf for \mathbf which is a reshaped version of \mathbf . By following the procedure outlined above, it is then possible to determine \mathbf from a set of eight matching points. In practice, however, the resulting fundamental matrix may not be useful for determining epipolar constraints.


Difficulty

The problem is that the resulting \mathbf often is
ill-conditioned In numerical analysis, the condition number of a function measures how much the output value of the function can change for a small change in the input argument. This is used to measure how sensitive a function is to changes or errors in the input ...
. In theory, \mathbf should have one singular value equal to zero and the rest are non-zero. In practice, however, some of the non-zero singular values can become small relative to the larger ones. If more than eight corresponding points are used to construct \mathbf , where the coordinates are only approximately correct, there may not be a well-defined singular value which can be identified as approximately zero. Consequently, the solution of the homogeneous linear system of equations may not be sufficiently accurate to be useful.


Cause

Hartley addressed this estimation problem in his 1997 article. His analysis of the problem shows that the problem is caused by the poor distribution of the homogeneous image coordinates in their space, \mathbb^ . A typical homogeneous representation of the 2D image coordinate (y_, y_) \, is : \mathbf = \begin y_ \\ y_ \\ 1 \end where both y_, y_ \, lie in the range 0 to 1000–2000 for a modern digital camera. This means that the first two coordinates in \mathbf vary over a much larger range than the third coordinate. Furthermore, if the image points which are used to construct \mathbf lie in a relatively small region of the image, for example at (700,700) \pm (100,100) \, , again the vector \mathbf points in more or less the same direction for all points. As a consequence, \mathbf will have one large singular value and the remaining are small.


Solution

As a solution to this problem, Hartley proposed that the coordinate system of each of the two images should be transformed, independently, into a new coordinate system according to the following principle. * The origin of the new coordinate system should be centered (have its origin) at the centroid (center of gravity) of the image points. This is accomplished by a translation of the original origin to the new one. * After the translation the coordinates are uniformly scaled so that the mean of distances from the origin to the points equals \sqrt . This principle results, normally, in a distinct coordinate transformation for each of the two images. As a result, new homogeneous image coordinates \mathbf, \mathbf' are given by : \mathbf = \mathbf \, \mathbf : \mathbf' = \mathbf' \, \mathbf' where \mathbf, \mathbf' are the transformations (translation and scaling) from the old to the new ''normalized image coordinates''. This normalization is only dependent on the image points which are used in a single image and is, in general, distinct from normalized image coordinates produced by a normalized camera. The epipolar constraint based on the fundamental matrix can now be rewritten as : 0 = (\mathbf')^ \, ((\mathbf')^)^ \, \mathbf \, \mathbf^\, \mathbf = (\mathbf')^ \, \mathbf \, \mathbf where \mathbf = ((\mathbf')^)^ \, \mathbf \, \mathbf^ . This means that it is possible to use the normalized homogeneous image coordinates \mathbf, \mathbf' to estimate the transformed fundamental matrix \mathbf using the basic eight-point algorithm described above. The purpose of the normalization transformations is that the matrix \mathbf , constructed from the normalized image coordinates, in general, has a better condition number than \mathbf has. This means that the solution \mathbf is more well-defined as a solution of the homogeneous equation \mathbf \, \mathbf than \mathbf is relative to \mathbf . Once \mathbf has been determined and reshaped into \mathbf the latter can be ''de-normalized'' to give \mathbf according to : \mathbf = (\mathbf')^ \, \mathbf \, \mathbf In general, this estimate of the fundamental matrix is a better one than would have been obtained by estimating from the un-normalized coordinates.


Using fewer than eight points

Each point pair contributes with one constraining equation on the element in \mathbf . Since \mathbf has five degrees of freedom it should therefore be sufficient with only five point pairs to determine \mathbf . David Nister proposed an efficient solution to estimate the essential matrix from set of five paired points, known as the five-point algorithm. Hartley et. al. later proposed a modified and more stable five-point algorithm based on Nister's algorithm.


See also

*
Essential matrix In computer vision, the essential matrix is a 3 \times 3 matrix, \mathbf that relates corresponding points in stereo images assuming that the cameras satisfy the pinhole camera model. Function More specifically, if \mathbf and \mathbf' ar ...
** Essential matrix#Extracting rotation and translation * Fundamental matrix *
Trifocal tensor In computer vision, the trifocal tensor (also tritensor) is a 3×3×3 array of numbers (i.e., a tensor) that incorporates all projective geometric relationships among three views. It relates the coordinates of corresponding points or lines in thr ...


References


Further reading

* * * {{cite journal , author=H. Christopher Longuet-Higgins , title=A computer algorithm for reconstructing a scene from two projections , journal=Nature , date=September 1981 , volume=293 , issue=5828 , pages=133–135 , doi=10.1038/293133a0, bibcode=1981Natur.293..133L , s2cid=4327732 Geometry in computer vision