📅 Due Date: 10/08/2024
👤 Name: Nicholas Beach (nbeach)
Objective:
The goal of this task is to compute P from 2D-3D point correspondences.
Standford Bunny:
$$ P = \begin{pmatrix} 6431.6937 & -2948.4374 & 1146.5806 & 2227.2435 \\ -934.8192 & -6754.8647 & 2029.4901 & 1822.1878 \\ 0.5793 & -1.4239 & -0.7353 & 1 \end{pmatrix} $$
Cuboid:
$$ P = \begin{pmatrix} 51.2163 & -35.6975 & -2.9882 & 83.8286 \\ -10.5438 & -10.9962 & -56.3862 & 89.9993 \\ 0.0884 & 0.0676 & -0.0397 & 1 \end{pmatrix} $$
Objective:
The goal is to compute K from a triad of orthogonal vanishing points, assuming that the camera has zero skew, and that the pixels are square.
Loading Annotation Data:
get_point_data(image)
loads pre-captured annotation data from a .npy
file, containing points corresponding to lines in the image. These points are used to calculate the lines in the image that should be parallel.Calculating Lines:
calc_lines(points)
computes the line equation for each pair of points using the cross product. These lines are then used for further calculations. Each line is represented as a 3D vector $ l = [a, b, c] $, where the equation of the line is:
$$
ax + by + c = 0
$$Finding Intersection Points:
get_intersect_points(lines)
computes the intersection of lines, specifically looking for points at infinity where parallel lines meet. The intersection is determined using the cross product of the corresponding line equations.Computing Omega and K:
Vanishing Points Method:
$$ K = \begin{pmatrix} 1154.178 & 0 & 575.066 \\ 0 & 1154.178 & 431.9391 \\ 0 & 0 & 1 \end{pmatrix} $$
Loading Annotation Data:
get_point_data(image)
loads pre-captured annotation data from a .npy
file, containing points corresponding to lines in the image. These points are used to calculate the lines in the image that should be parallel.Homography Calculation:
Homography is computed to transform points from the perspective image (pers_points
) to corresponding points in the normal image (norm_points
), using the computeH()
and computeH_norm()
functions.
Affine Homography Matrix (H
):
The matrix is computed by solving the linear system for point correspondences using Singular Value Decomposition (SVD):
$$
A \mathbf{h} = 0
$$
where $A$ is the matrix containing the relationships between points, and $h$ is the homography matrix. After SVD, the smallest singular value corresponds to the desired homography.
Normalization:
Before computing the homography, the points are normalized using translation and scaling transformations to improve numerical stability. The normalization includes:
After homography estimation, the result is denormalized to get the final transformation matrix.
Computing Omega and K:
Computing Angles Between Planes
Metric Planes Method:
$$ K = \begin{pmatrix} 1083.725 & -11.7859 & 517.3594 \\ 0 & 1078.2298 & 398.2625 \\ 0 & 0 & 1 \end{pmatrix} $$
Angle between planes(deg) | |
---|---|
Plane 1 and 2 | 67.50040549736326 |
Plane 1 and 3 | 87.76621056186771 |
Plane 2 and 3 | 94.79064336880757 |
Objective:
The goal is to reconstruct a colored point cloud from a single image.
Loading Annotation Data:
get_point_data(image)
loads pre-captured annotation data from a .npy
file, containing points corresponding to lines in the image. These points are used to calculate the lines in the image that should be parallel.Calculating Lines:
calc_lines(points)
computes the line equation for each pair of points using the cross product. These lines are then used for further calculations. Each line is represented as a 3D vector $ l = [a, b, c] $, where the equation of the line is:
$$
ax + by + c = 0
$$Finding Intersection Points:
get_intersect_points(lines)
computes the intersection of lines, specifically looking for points at infinity where parallel lines meet. The intersection is determined using the cross product of the corresponding line equations.Computing Omega and K:
Calculating 3D Points:
Reconstruction:
$$
K = \begin{pmatrix}
808.5202 & 0 & 510.7118 \\
0 & 808.5202 & 363.6361 \\
0 & 0 & 1
\end{pmatrix}
$$
Angle between planes(deg) | |
---|---|
Plane left and right | 90.0 |
Plane left and ground | 89.48754224219331 |
Plane right and ground | 93.17281814528123 |