16822 Assignment 2
Andrew ID: aniketa
Q1 Camera matrix P
from 2D-3D correspondences
(a) Stanford Bunny
Camera Matrix:
[ 6.12468612e-01 -2.80769806e-01 1.09185025e-01 2.12092927e-01]
[-8.90197009e-02 -6.43243106e-01 1.93261536e-01 1.73520830e-01]
[ 5.51654830e-05 -1.35588807e-04 -7.00171505e-05 9.52266452e-05]
Input Surface Points Bounding Box
(b) Cuboid
Here I just use a cube image:
the P matrix for this is:
[ 8.48750293e-02 -3.13283842e01 1.66712838e-01 1.13879826e-01]
[-5.43127493e-01 -6.97329081e01 -3.45671298e-02 3.73476722e-01]
[ 7.78230821e-04 1.53125456e-01 -4.77671297e-03 7.98436784e-04]
Q2 Camera calibration K
from annotations
(a) Camera Calibration from Vanishing Points
K Matrix:
[1.15417802e+03 0.00000000e+00 5.75066005e+02]
[0.00000000e+00 1.15417802e+03 4.31939090e+02]
[0.00000000e+00 0.00000000e+00 1.00000000e+00]

Method:
- Compute the vanishing points by taking the cross products between parallel lines and normalizing by last coordinate.
- For each pair of vanishing points, we form simple equations: [x1 * x2 + y1 * y2, x1 + x2, y1 + y2, 1]
- Solve the system using SVD, with the image of absolute conic being the last row of Vt.
- The IAC can then be constructed as:

- Cholensky Decomposition on this to get the intrinsic matrix K.
(b) Camera Calibration from Metric Planes
Matrix K:
[ 1.08447642e+03 -1.35121131e+01 5.20013594e+02]
[ 0.00000000e+00 1.07900526e+03 4.02544642e+02]
[ 0.00000000e+00 0.00000000e+00 1.00000000e+00]
Angle between Plane 1 & Plane 2: 67.58 degrees
Angle between Plane 1 & Plane 3: 92.25 degrees
Angle between Plane 2 & Plane 3: 94.78 degrees

Method:
- First we compute homography between the given image points and the assumed world coordinates for the squares [ [0, 0], [0, 1], [1, 0], [1, 1] ]
- For each homography , we have these constraints:
- We can write these constraints as Ax = 0, where x is a vector of the unknown elements of . Since is symmetric, we have 6 unknowns and 6 constraints.
- Then we get SVD of A and take the last column of V.
- Using Cholesky decomposition, we can get intrinsic matrix K from .
Q3 Single View Reconstruction
(a)
Input Image With Annotations
Reconstructions
Obatined K:
[ 8.09951409e+02 0.00000000e+00 5.10720088e+02]
[ -3.48409833e-14 8.09951409e+02 3.56268955e+02]
[ -0.00000000e+00 0.00000000e+00 1.00000000e+00]
Method:
- Obtaining the intrinsic matrix K by calculating vanishing points and IAC similar to as done in q2a.
- Now, for first plane calculation:
- Convert annotation to 3D ray:
pt1_ray = inv(K) * [x, y, 1]
- Get plane normals:
n = np.cross(d1, d2)
- First plane equation:
plane1 = [nx, ny, nz, -dot(normal, pt1_3d)]
- Convert annotation to 3D ray:
- Similarly for other planes, first we backproject other plane’s corners to 3D and for each remaining rectangle
plane = [nx, ny, nz, -dot(normal, corner_3d)]
- Now getting pixel coordinates in each rectangle and computing their 3D position by projecting along the ray
point3d = -ray * d / dot(ray, normal)
- Scatter plot for visualization