top of page

3D reconstruction from two images 

Description 

  • Abstract

Estimation of the essential matrix:

we want to formulate and solve a linear system Ae = 0 where A is some matrix containing the point positions and e contains the parameters of E, to estimate. Then we use the 8-point algorithm. Aes=0, es is the null space of A, hence, es=v9, Then project the E onto the space of essential matrices by using svd and returning U diag(1,1,0)V’

​

RANSAC estimation:

  • Pick a random set of 8 pairs

  • estimate E using them and compute the individual residuals for all the other pairs (x1, x2): d(x2, epi(x1))2 +d(x1, epi(x2))2

  • Count how many residuals are lower than ε = 10−5(consensus set), and if this count is the largest so far, store the current estimate of E as the best estimate so far, Iterate as many times as needed according to the probability of failure , I use 2000 iteration instead of 500 to get a more steady result.

Drawing the Epipolar lines:

  • Calculate the fundamental matrix, F = inv(K')*E*inv(K);

  • epiLines1 = (U2*F)';

  • epiLines2 = (F*U1');

Pose recovery and 3D reconstruction:

The four configuration are enumerated below:

1. t1 = U(:; 3) and R1 = UWVT

2. t2 = -U(:; 3) and R2 = UWVT

3. t3 = U(:; 3) and R3 = UW’VT

4. t4 = -U(:; 3) and R4 = UW’VT.

If the determinant of the rotation matrix is negative 1. The camera pose must be corrected with t=-t, R=-R.

Triangulation:

we can reconstruct the 3D point by computing the intersection of the two rays coming from camera 1 and 2: λ2x2 = λ1Rx1 + T, In practice, the equality doesn’t hold (the two rays don’t intersect perfectly) and you need to do a least square estimation of λ 1, λ2.

​

show Re-projections:

P2proj =(K*((R)'*(P2'-T)))';

P1proj =(K*(R*P1'+T))';

​

​

​

bottom of page