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:

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

  1. 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] ]
  1. For each homography , we have these constraints:
    Hi=[h1,h2,h3]H_i = [h_1, h_2, h_3]
h1Tωh1h2Tωh2=0h1Tωh2=0h_1^T \omega h_1 - h_2^T \omega h_2 = 0 \\ h_1^T \omega h_2 = 0
  1. We can write these constraints as Ax = 0, where x is a vector of the unknown elements of ω\omega. Since ω\omega is symmetric, we have 6 unknowns and 6 constraints.
  1. Then we get SVD of A and take the last column of V.
  1. Using Cholesky decomposition, we can get intrinsic matrix K from ω\omega.

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:

  1. Obtaining the intrinsic matrix K by calculating vanishing points and IAC similar to as done in q2a.
  1. Now, for first plane calculation:
    1. Convert annotation to 3D ray: pt1_ray = inv(K) * [x, y, 1]
    1. Get plane normals: n = np.cross(d1, d2)
    1. First plane equation: plane1 = [nx, ny, nz, -dot(normal, pt1_3d)]
  1. Similarly for other planes, first we backproject other plane’s corners to 3D and for each remaining rectangleplane = [nx, ny, nz, -dot(normal, corner_3d)]
  1. Now getting pixel coordinates in each rectangle and computing their 3D position by projecting along the ray point3d = -ray * d / dot(ray, normal)
  1. Scatter plot for visualization