`
I computed the camera projection matrix that goes from the world 3D coordinates to 2D image coordinates using homogeneous coordinates. Using this matrix (M), I then calculated the camera center for both the sets of points given (normalised and unnormalised.)
My
[U, S, V]= svd(A);
M = V(:,end);
M = reshape(M,[],3)';
Results:
Normalized input points |
The projection matrix is:
0.4583 -0.2947 -0.0140 0.0040
-0.0509 -0.0546 -0.5411 -0.0524
0.1090 0.1783 -0.0443 0.5968
The total residual is: 0.0445
The estimated location of camera is: (-1.5127, -2.3517, 0.2826)
Not-normalized input points |
The projection matrix is:
0.0069 -0.0040 -0.0013 -0.8267
0.0015 0.0010 -0.0073 -0.5625
0.0000 0.0000 -0.0000 -0.0034
The total residual is: 15.5450
The estimated location of camera is: (303.1000, 307.1843, 30.4217)
My
[U D V]= svd(A);
F = V(:,end);
F = reshape(F,[],3)';
[Uf Df Vf]= svd(F);
Df(end, end) = 0;
F_matrix = Uf*Df*Vf';
To improve the estimated Fundamental Matrix, I normalized the input points. The
% Estimate scale and mean for a
mean_ax = mean(Points_a(:,1));
mean_ay = mean(Points_a(:,2));
scale_ax = 1/std(Points_a(:,1)-mean_ax );
scale_ay = 1/std(Points_a(:,2)-mean_ay );
% Transform a
Points_a = [Points_a ones(n,1)];
Points_a = (T_a*Points_a(:,1:3)')';
[U D V]= svd(A);
F = V(:,end);
F = reshape(F,[],3)';
[Uf Df Vf]= svd(F);
Df(end, end) = 0;
F_matrix = Uf*Df*Vf';
F_matrix = T_b' * F_matrix * T_a;
Results:
|
|
Without normalized input points: Slight difference between the lines and dots is present. | |
|
|
With normalized input points: Almost perfect crossing of lines on dots. |
Conclusion: Even though here not much difference is observed (because the input correspondences are pretty much perfect), we expect to see a better improvement in the next part - RANSAC.
For this Select-Compute-Update type algorithm, I tried a bunch of values for the different parameters such as:
My
Below are the results for RANSAC using 0.005 as a threshold, for both versions of part 2 [un-normalised(BEFORE) and normalised(AFTER) points used for fundamental matrix estimation]
Without normalized input points: About 137 inliers found. |
After normalization: About 649 inliers found. | |
Reducing it to 30 for a neater visualization. |
Without normalized input points: About 135 inliers found. |
After normalization: About 520 inliers found. | |
Reducing it to 30 for a neater visualization. |
Without normalized input points: About 200 inliers found. |
After normalization: About 212 inliers found. | |
Reducing it to 30 for a neater visualization. |
Without normalized input points: About 202 inliers found. Note how some points are completely incorrectly matched. |
After normalization: About 374 inliers found. Much better matched due to normalization. | |
Reducing it to 30 for a neater visualization. |
For the un-normalized points, the fundamental matrix isn't as accurate as the that for the normalized points. For a threshold of 0.005, the normalization helps achieve more inliers and more accurate inliers when RANSAC is performed to estimate the fundamental matrix.