pkoch - HW2ΒΆ

Q1a - P From 2D-3D correspondancesΒΆ

P= [[ 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]]
<Figure size 10000x10000 with 0 Axes>
No description has been provided for this image

Q1b - P From 2D-3D correspondancesΒΆ

For this problem, I interpolated between the 3d points of the object such that each point is separated by .1 inches from the point next to it, then projected these into the image plane.

P= [[ 9.80814619e-02  2.11186274e-01  9.93098743e-02 -6.72374235e-01]
 [ 3.91813086e-02 -6.89269401e-02  2.35918982e-01 -6.49527757e-01]
 [-3.17786136e-05  3.32633248e-05  4.30185130e-05 -8.03726758e-04]]
<Figure size 10000x10000 with 0 Axes>
No description has been provided for this image

Q2a - Camera calibration KΒΆ

K= [[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]]
<Figure size 10000x10000 with 0 Axes>
No description has been provided for this image

See above for $K$. The principal point is marked in blue in the third image.

For this problem, we can follow the following algorithm:

  1. Find three vanishing points of orthogonal directions.
  2. Given parallel lines annotated in the image as pairs of points, line $l_{i,a}=x_{i,1} \times x_{i,2}$
  3. The vanishing point of two such parallel lines can be found $v_i = l_{i,a} \times l_{i,b}$'
  4. Then for an $\omega= \left[\begin{matrix}w_{1} & 0 & w_{2}\\0 & w_{1} & w_{3}\\w_{2} & w_{3} & w_{4}\end{matrix}\right]$, we know $v_i^T \omega v_j=0$
  5. We can assemble these constraints between vanishing points corresponding to orthogonal directions, and use SVD to determine $\omega$.
  6. Given $\omega$, which is PSD, we take the Cholesky decomposition to determine $K=L^{-T}$.

Q2b - Camera calibration KΒΆ

Angle between plane 1 and plane 2 = 112.66 degrees
  if inverted = 67.34 degrees
Angle between plane 1 and plane 3 = 92.21 degrees
  if inverted = 87.79 degrees
Angle between plane 2 and plane 3 = 85.30 degrees
  if inverted = 94.70 degrees
<Figure size 10000x10000 with 0 Axes>
No description has been provided for this image

See above for $K$.

Angles:

Angle between planes (degrees)
plane 1 and plane 2 67.34
plane 1 and plane 3 92.21
plane 2 and plane 3 94.70

Note that I flipped the first and third rows $180 \degree$s as I think the plane normal vectors are inverted.

Algorithm:

  1. For this problem, we define the unit square and determine a homography from that square to each imaged square. We can use the same procedure here as in the previous assignment.
  2. Next, for $H=[h_1, h_2, h_3]$, we can define the constraints $h_1^T\omega h_2=0$ and $h_1^T\omega h_1 - h_2^T\omega h_2=0$ (for each square) per the images of the circular points of the plane defined by each square.
  3. We can then solve for $\omega$ and $K$ in the same manner as Q2a.

Q2c - Camera calibration KΒΆ

K= [[3.14558418e+03 1.01079398e+02 1.91911900e+03]
 [0.00000000e+00 3.30323354e+03 1.59606999e+03]
 [0.00000000e+00 0.00000000e+00 1.00000000e+00]]
Angle between plane 1 and plane 2 = 118.28 degrees
Angle between plane 1 and plane 3 = 74.14 degrees
Angle between plane 2 and plane 3 = 106.47 degrees
<Figure size 10000x10000 with 0 Axes>
No description has been provided for this image

See above for $K$ and angles.

Algorithm:

  1. To obtain an $H$ which represents a metric rectification, we can measure the aspect ratio of our physical rectangle and adjust our "source plane" to have the same ratio.
  2. In this case, I measured an aspect ratio of 2.20:1.
  3. We can then proceed as in Q2b.

Q3 - ReconstructionΒΆ

<Figure size 10000x10000 with 0 Axes>
No description has been provided for this image

For this problem, I used the following algorithm:

  1. I first obtained $K$ via vanishing points per problem Q2a.
  2. Next I chose a fixed point (point "2" in the annotation image - it's the lower center one) and deprojected it. I chose a z-depth of 1 to fix the reconstruction scale. Calling this $\tilde{X}_{fixed}$,
  3. For each of the 5 annotated planes, I found the plane normal via deprojected vanishing points. For two vanishing points of parallel lines on the plane, $v_1, v_2$, we know the 3D direction corresponding to each via $d_i = K^{-1}v_i$. We then can determine the normal direction to the plane as $n = d_1 \times d_2$.
  4. To determine a 3D plane, we must fix the plane intercept. We can determine this $\pi_d=-n^T \tilde{X}_{fixed}$ to satisfy the equation of a plane. Note that since the $\tilde{X}_{fixed}$ I chose does not lie on the latter two planes, I also determined $\tilde{X}_{fixed,2}$ as the uppermost center annotated point. This point in 3D is the intersection of the ray through that pixel and any of the 3D planes which intersect $\tilde{X}_{fixed}$.
  5. Finally, I used OpenCV to check which pixels lay within the annotated contour of each plane, and then determined their 3D location as the intersection of the ray passing through that pixel (call this ray $d$) and the relevant plane: $\tilde{X}=-(\pi_d/n^Td)d$