Suvarna Garge (Editor)

Eight point algorithm

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Eight-point algorithm

The eight-point algorithm is an algorithm used in computer vision to estimate the essential matrix 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.

Contents

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 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 O L P ¯ , O R P ¯ and O R O L ¯ 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 equals to zero because the vector generated from T X L is orthogonal to both T and X L  :

X L T T X L T T T X L = ( X L T ) T T X L = 0

Because I = R T R , we get

( X L T ) T R T R T X L = 0 .

Replacing ( X L T ) T R T with X R T , we get

X R T R T X L = X R T R S X L = X R T E X L = 0

Observe that T may be thought of as a matrix; Longuet-Higgins used the symbol S to denote it. The product R T T = R S is often called essential matrix and denoted with E .

The vectors O L p L ¯ , O R p R ¯ are parallel to the vectors O L P ¯ , O R P ¯ 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 E y = 0

The basic algorithm

The basic eight-point algorithm is here described for the case of estimating the essential matrix E . It consists of three steps. First, it formulates a homogeneous linear equation, where the solution is directly related to E , 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 E is

( y ) T E y = 0

for corresponding image points represented in normalized image coordinates y , y . The problem which the algorithm solves is to determine E 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 E 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

With

y = ( y 1 y 2 1 )   and   y = ( y 1 y 2 1 )   and   E = ( e 11 e 12 e 13 e 21 e 22 e 23 e 31 e 32 e 33 )

the constraint can also be rewritten as

y 1 y 1 e 11 + y 1 y 2 e 12 + y 1 e 13 + y 2 y 1 e 21 + y 2 y 2 e 22 + y 2 e 23 + y 1 e 31 + y 2 e 32 + e 33 = 0

or

e y ~ = 0

where

y ~ = ( 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 )   and   e = ( e 11 e 12 e 13 e 21 e 22 e 23 e 31 e 32 e 33 )

that is, e represents the essential matrix in the form of a 9-dimensional vector and this vector must be orthogonal to the vector y ~ which can be seen as a vector representation of the 3 × 3 matrix y y T .

Each pair of corresponding image points produces a vector y ~ . Given a set of 3D points P k this corresponds to a set of vectors y ~ k and all of them must satisfy

e y ~ k = 0

for the vector e . Given sufficiently many (at least eight) linearly independent vectors y ~ k it is possible to determine e in a straightforward way. Collect all vectors y ~ k as the columns of a matrix Y and it must then be the case that

e T Y = 0

This means that e is the solution to a homogeneous linear equation.

Step 2: Solving the equation

A standard approach to solving this equation implies that e is a left singular vector of Y corresponding to a singular value that equals zero. Provided that at least eight linearly independent vectors y ~ k are used to construct Y it follows that this singular vector is unique (disregarding scalar multiplication) and, consequently, e and then E can be determined.

In the case that more than eight corresponding points are used to construct Y 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 problem; find e which minimizes

e T Y

when e = 1 . The solution is to choose e as the left singular vector corresponding to the smallest singular value of Y . A reordering of this e back into a 3 × 3 matrix gives the result of this step, here referred to as E e s t .

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 E of rank 2 which minimizes

E E e s t

where E e s t 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 of E e s t :

E e s t = U S V T

where U , V are orthogonal matrices and S is a diagonal matrix which contains the singular values of E e s t . In the ideal case, one of the diagonal elements of S should be zero, or at least small compared to the other two which should be equal. In any case, set

S = ( ( s 1 + s 2 ) / 2 0 0 0 ( s 1 + s 2 ) / 2 0 0 0 0 ) ,

where s 1 , s 2 are the two larger singular values in S . Finally, E is given by

E = U S V T

The matrix E is the resulting estimate of the essential matrix provided by the algorithm.

Determining R and t from E

This topic is covered in the page on the Essential matrix (section on determining R and t from E).

The normalized eight-point algorithm

The basic eight-point algorithm can in principle be used also for estimating the fundamental matrix F . The defining constraint for F is

( y ) T F y = 0

where y , y are the homogeneous representations of corresponding image coordinates (not necessary normalized). This means that it is possible to form a matrix Y in a similar way as for the essential matrix and solve the equation

f T Y = 0

for f which is a reshaped version of F . By following the procedure outlined above, it is then possible to determine F from a set of eight matching points. In practice, however, the resulting fundamental matrix may not be useful for determining epipolar constraints.

The problem

The problem is that the resulting Y often is ill-conditioned. In theory, Y 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 Y , 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.

What's causing the problem

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, R 3 . A typical homogeneous representation of the 2D image coordinate ( y 1 , y 2 ) is

y = ( y 1 y 2 1 )

where both y 1 , y 2 lie in the range 0 to 1000-2000 for a modern digital camera. This means that the first two coordinates in y vary over a much larger range than the third coordinate. Furthermore, if the image points which are used to construct Y lie in a relatively small region of the image, for example at ( 700 , 700 ) ± ( 100 , 100 ) , again the vector y points in more or less the same direction for all points. As a consequence, Y will have one large singular value and the remaining are small.

How it can be solved

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 distance from the origin to a point equals 2 .
  • This principle results, normally, in a distinct coordinate transformation for each of the two images. As a result, new homogeneous image coordinates y ¯ , y ¯ are given by

    y ¯ = T y y ¯ = T y

    where T , T 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 = ( y ¯ ) T ( ( T ) T ) 1 F T 1 y ¯ = ( y ¯ ) T F ¯ y ¯

    where F ¯ = ( ( T ) T ) 1 F T 1 . This means that it is possible to use the normalized homogeneous image coordinates y ¯ , y ¯ to estimate the transformed fundamental matrix F ¯ using the basic eight-point algorithm described above.

    The purpose of the normalization transformations is that the matrix Y ¯ , constructed from the normalized image coordinates, in general has a better condition number than Y has. This means that the solution f ¯ is more well-defined as a solution of the homogeneous equation Y ¯ f ¯ than f is relative to Y . Once f ¯ has been determined and reshaped into F ¯ the latter can be de-normalized to give F according to

    F = ( T ) T F ¯ T

    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 E . Since E has five degrees of freedom it should therefore be sufficient with only five point pairs to determine E . Though possible from a theoretical point of view, the practical implementation of this is not straightforward and relies on solving various non-linear equations.

    References

    Eight-point algorithm Wikipedia