This is my webpage submission for 16822 assignment 1.

Q1: 8-point and 7-point algorithm

Q1a: F matrix using 8-point algorithm

I solved the fundamental matrix equation xTFx=0x'^TFx = 0 with 8 point correspondences between images using the following steps:

Bench results:

Viewpoint 1 (Points)
Viewpoint 2 (Epipolar Lines)
Viewpoint 2 (Points)
Viewpoint 1 (Epipolar Lines)

Estimated E for bench: (0.415242748.817488942.150558081.38035590.7906713469.082650363.5889087668.474387011)\begin{pmatrix} -0.41524274 & -8.81748894 & -2.15055808 \\ -1.3803559 & 0.79067134 & 69.08265036 \\ -3.58890876 & -68.47438701 & 1 \end{pmatrix}

Remote results:

Viewpoint 1 (Points)
Viewpoint 2 (Epipolar Lines)
Viewpoint 2 (Points)
Viewpoint 1 (Epipolar Lines)

Estimated E for remote: (2.52980640.670561787.330948376.620327493.0276846628.2986166514.5007109226.418247811)\begin{pmatrix} 2.5298064 & -0.67056178 & 7.33094837 \\ -6.62032749 & -3.02768466 & -28.29861665 \\ -14.50071092 & 26.41824781 & 1 \end{pmatrix}

Q1b: 7-point algorithm

I solved the fundamental matrix equation xTFx=0x'^TFx = 0 with 8 point correspondences between images using the following steps:

Ball annotations:

Viewpoint 1 (Points)
Viewpoint 2 (Points)

Ball results:

Viewpoint 1 (Epipolar Lines)
Viewpoint 2 (Epipolar Lines)

Hydrant annotations:

Viewpoint 1 (Points)
Viewpoint 2 (Points)

Hydrant results. The third set of epipolar lines represent the correct F matrix:

Viewpoint 1 (Epipolar Lines 1)
Viewpoint 2 (Epipolar Lines 1)
Viewpoint 1 (Epipolar Lines 2)
Viewpoint 2 (Epipolar Lines 2)
Viewpoint 1 (Epipolar Lines 3)
Viewpoint 2 (Epipolar Lines 3)

Q2: RANSAC with 7-point and 8-point algorithm

To implement RANSAC in the 8pt algorithm:

To implement RANSAC with the 7pt algorithm was largely the same as the 8pt algorithm. A key difference was that I computed the error for all F matrices if there were more than one produced from the 7pt algorithm. Also, my sample of point correspondences only included 7 instead of 8 for this exercise.

Note that for the following results, many image pairs produced more than one F matrix using the 7pt algorithm. For the sake of readability, in these results, I show only the best results. These results have been hand-picked based on the appearance of their epipolar lines.

8pt Bench results:

Best F: (1.43391108e072.90583671e063.02620285e049.27002442e082.54945574e072.51935268e021.14221489e032.32675030e021.00000000e+00)\begin{pmatrix} -1.43391108e-07 & -2.90583671e-06 & 3.02620285e-04 \\ -9.27002442e-08 & 2.54945574e-07 & 2.51935268e-02 \\ -1.14221489e-03 & -2.32675030e-02 & 1.00000000e+00 \end{pmatrix}

Viewpoint 1 (Points)
Viewpoint 2 (All Inlier Epipolar Lines)
Viewpoint 2 (Sampled Inlier Epipolar Lines)
Viewpoint 2 (Points)
Viewpoint 1 (All Inlier Epipolar Lines)
Viewpoint 1 (Sampled Inlier Epipolar Lines)

7pt Bench results:

Best F: (7.16551895e081.95227668e061.05650737e059.16780150e073.82041574e072.43876291e028.74012444e042.26454361e021.00000000e+00)\begin{pmatrix} -7.16551895e-08 & -1.95227668e-06 & -1.05650737e-05 \\ -9.16780150e-07 & 3.82041574e-07 & 2.43876291e-02 \\ -8.74012444e-04 & -2.26454361e-02 & 1.00000000e+00 \end{pmatrix}

Viewpoint 1 (Points)
Viewpoint 2 (All Inlier Epipolar Lines)
Viewpoint 2 (Sampled Inlier Epipolar Lines)
Viewpoint 2 (Points)
Viewpoint 1 (All Inlier Epipolar Lines)
Viewpoint 1 (Sampled Inlier Epipolar Lines)

Comparison of 7pt vs. 8pt algorithms for Bench

Inliers vs Iterations

8pt Remote results:

Best F: (1.81496664e061.33152268e073.09432203e036.25315407e061.39286815e061.17648259e024.39200342e031.45596740e021.00000000e+00)\begin{pmatrix} 1.81496664e-06 & -1.33152268e-07 & 3.09432203e-03 \\ -6.25315407e-06 & -1.39286815e-06 & -1.17648259e-02 \\ -4.39200342e-03 & 1.45596740e-02 & 1.00000000e+00 \end{pmatrix}

Viewpoint 1 (Points)
Viewpoint 2 (All Inlier Epipolar Lines)
Viewpoint 2 (Sampled Inlier Epipolar Lines)
Viewpoint 2 (Points)
Viewpoint 1 (All Inlier Epipolar Lines)
Viewpoint 1 (Sampled Inlier Epipolar Lines)

7pt Remote results:

Best F: (1.02427317e061.17606920e072.60290852e033.55432803e061.56076230e061.01099221e024.25880656e031.21573246e021.00000000e+00)\begin{pmatrix} 1.02427317e-06 & 1.17606920e-07 & 2.60290852e-03 \\ -3.55432803e-06 & -1.56076230e-06 & -1.01099221e-02 \\ -4.25880656e-03 & 1.21573246e-02 & 1.00000000e+00 \end{pmatrix}

Viewpoint 1 (Points)
Viewpoint 2 (All Inlier Epipolar Lines)
Viewpoint 2 (Sampled Inlier Epipolar Lines)
Viewpoint 2 (Points)
Viewpoint 1 (All Inlier Epipolar Lines)
Viewpoint 1 (Sampled Inlier Epipolar Lines)

Comparison of 7pt vs. 8pt algorithms for Remote

Inliers vs Iterations

8pt Ball results:

Best F: (3.79242198e082.81287023e066.72388101e033.40854975e068.70737012e071.45432565e028.91864450e031.44043905e021.00000000e+00)\begin{pmatrix} 3.79242198e-08 & -2.81287023e-06 & -6.72388101e-03 \\ 3.40854975e-06 & -8.70737012e-07 & -1.45432565e-02 \\ 8.91864450e-03 & 1.44043905e-02 & 1.00000000e+00 \end{pmatrix}

Viewpoint 1 (Points)
Viewpoint 2 (All Inlier Epipolar Lines)
Viewpoint 2 (Sampled Inlier Epipolar Lines)
Viewpoint 2 (Points)
Viewpoint 1 (All Inlier Epipolar Lines)
Viewpoint 1 (Sampled Inlier Epipolar Lines)

7pt Ball results:

Best F: (1.58895816e073.31042336e066.49711691e033.84358342e069.31357129e071.54382394e029.06528994e031.53623697e021.00000000e+00)\begin{pmatrix} -1.58895816e-07 & -3.31042336e-06 & -6.49711691e-03 \\ 3.84358342e-06 & -9.31357129e-07 & -1.54382394e-02 \\ 9.06528994e-03 & 1.53623697e-02 & 1.00000000e+00 \end{pmatrix}

Viewpoint 1 (Points)
Viewpoint 2 (All Inlier Epipolar Lines)
Viewpoint 2 (Sampled Inlier Epipolar Lines)
Viewpoint 2 (Points)
Viewpoint 1 (All Inlier Epipolar Lines)
Viewpoint 1 (Sampled Inlier Epipolar Lines)

Comparison of 7pt vs. 8pt algorithms for Ball

Inliers vs Iterations

8pt Hydrant results:

Best F: (9.83590525e084.74603263e061.17059748e036.31769701e061.30673063e071.72794523e028.30289487e041.71940163e021.00000000e+00)\begin{pmatrix} 9.83590525e-08 & -4.74603263e-06 & -1.17059748e-03 \\ 6.31769701e-06 & -1.30673063e-07 & -1.72794523e-02 \\ 8.30289487e-04 & 1.71940163e-02 & 1.00000000e+00 \end{pmatrix}

Viewpoint 1 (Points)
Viewpoint 2 (All Inlier Epipolar Lines)
Viewpoint 2 (Sampled Inlier Epipolar Lines)
Viewpoint 2 (Points)
Viewpoint 1 (All Inlier Epipolar Lines)
Viewpoint 1 (Sampled Inlier Epipolar Lines)

7pt Hydrant results:

Best F: (1.14869100e072.88997281e061.48587121e034.33394304e062.17393889e071.63989254e021.26550572e031.60085438e021.00000000e+00)\begin{pmatrix} 1.14869100e-07 & -2.88997281e-06 & -1.48587121e-03 \\ 4.33394304e-06 & 2.17393889e-07 & -1.63989254e-02 \\ 1.26550572e-03 & 1.60085438e-02 & 1.00000000e+00 \end{pmatrix}

Viewpoint 1 (Points)
Viewpoint 2 (All Inlier Epipolar Lines)
Viewpoint 2 (Sampled Inlier Epipolar Lines)
Viewpoint 2 (Points)
Viewpoint 1 (All Inlier Epipolar Lines)
Viewpoint 1 (Sampled Inlier Epipolar Lines)

Comparison of 7pt vs. 8pt algorithms for Hydrant

Inliers vs Iterations

Q3: Triangulation

Triangulating allows us to reconstruct a 3D scene from 2D point correspondences. To accomplish this, I took the following steps:

Reconstruction Image 1
Reconstruction Image 2
Reconstruction gif

Q4 Reconstruct your own scene!

Multi-view sloth images:

Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI

Multi-view mug images:

Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI
Sloth GIF using GUI

Results using COLMAP GUI:

Sloth GIF using GUI
Mug GIF using GUI

Results using pycolmap package. The green spheres represent the cameras used to capture each image.

Sloth GIF using pycolmap
Mug GIF using pycolmap

Q5 Fundamental matrix estimation on your own images

Q6 Stress test the hyperparameters of COLMAP

Chosen questions for stress tests:

Cutting the number of images in half (choosing every other image) results in a far poorer 3D reconstruction. It stands to reason from this result that more images of the scene lead to a more faithful reconstruction

Sloth GIF using half of images
Mug GIF using half of images

The number of SIFT features defaults to a maximum of 8192. Limiting this to 1000 leads to a sparser reconstruction, because there are fewer features on which to match between the provided images. Fewer matches means fewer correspondences and therefore fewer 3D points projected. By similar logic, doubling the number of SIFT features to 16384 yields a denser reconstruction.

Sloth GIF (1000 SIFT features)
Mug GIF (1000 SIFT features)
Sloth GIF (16384 SIFT features)
Mug GIF (16384 SIFT features)

The peak_threshold parameter in COLMAP defaults to 0.006667 and is the cutoff for a pixel to be marked as a keypoint when using SIFT and the difference-of-Gaussians metric to compare pixel neighborhoods at varying scales. A lower threshold means that regions with lower contrast will be identified as keypoints, thereby typically increasing the number of keypoints. Conversely, a higher threshold means that the region around a given pixel must have a higher contrast to be considered a keypoint, thereby typically decreasing the number of keypoints. I observe this impact in my reconstructions, where the affect of halving this threshold is a denser reconstruction with more background points included. Conversely, the impact of doubling this threshold is that the reconstruction is a bit sparser.

Sloth GIF (0.003334 peak threshold)
Mug GIF (0.003334 peak threshold)
Sloth GIF (0.013334 peak threshold)
Mug GIF (0.013334 peak threshold)