Project 3: Camera Calibration and Fundamental Matrix Estimation with RANSAC

Part I: Camera Projection Matrix

I solve the system of equations by fixing m34 to be 1 and linear least square regression.

Part II: Fundamental Matrix Estimation

Use 9 corresponding points to construnct the homogeneous linear equations and solve the system using singular value decomposition. Since fundamental matrix is rank 2, impose this constraint by setting the smallest singluar value to zero.

Part III: Fundamental Matrix with RANSAC

Given the SIFT pairs generated by VLFeat, use RANSAC to find the best fundamental matrix. Randomly sample 9 paris from SIFT pairs and calculate the Fundamental matrix. To evaluate SIFT pairs, abs(p'*F*p) is the measure of how good the pair p' and p fit with F. Set the threhold to 0.1(the choice is based on trial and error). For pairs abs(p'*F*p) > 0.01 consider it to be outliers and otherwise inliers.

Set the number of iterations to 1000. Since N=log(1-p)/log(1-(1-e)^9) = 455 for p=0.99 and e=0.4, so 1000 iterations should be good enough in the case of 99% confidence that the 9 pairs are free of outliers even if there 40% outliers in SIFT pairs. The best fundamental matrix is the one with most inliners in 1000 iterations.

For visulization purpose, the figure only shows the top 30 inliers (inliers with smallest abs(p'*F*p)).

Extra credit: normalizing the coordinates

The system of linear equations for computing fundamental matrix may be ill-conditioned. To fix it, transform the coordinates of matching points to zero mean and magnitude in the range of [0,1] when estimating fundamental matrix.

Below is the improvement of normalizing the coordinates on Gaudi image pairs.The top one is the result of not normalized, the bottom one is result of normalized. The improvement in matching accuracy is significant.