Q1: Affine Rectification

Input images

Annotated images

Output images

Implementation

Find ll_\infty^\prime by finding intersection of parallel lines on line at infinity and restoring to its canonical position:

Q2: Metric Rectification

Input images

Same as for Q1

Annotated images

Output images

Implementation

Find image of conic dual to circular points CC^{\star\prime}_\infty s.t. for images of perpendicular lines ll^\prime and mm^\prime:

lCm=0l^{\prime\intercal} C^{\star\prime}_\infty m^{\prime} = 0

Where

C=[ab/2d/2b/2ce/2d/2e/2f]C^{\star\prime}_\infty = \begin{bmatrix} a & b/2 & d/2 \\ b/2 & c & e/2 \\ d/2 & e/2 & f \end{bmatrix}

Using the affine rectification result from question 1, d=e=f=0d=e=f=0:

C=[ab/20b/2c0000]C^{\star\prime}_\infty = \begin{bmatrix} a & b/2 & 0 \\ b/2 & c & 0 \\ 0 & 0 & 0 \end{bmatrix}

Expanding the polynomial represented by CC^{\star\prime}_\infty:

ax12+bx1x2+cx22+dx1x3+ex2x3+fx32=0ax12+bx1x2+cx22=0a{x_1}^2 + bx_1x_2 + c{x_2}^2 + dx_1x_3 + ex_2x_3 + f{x_3}^2 = 0 \\ a{x_1}^2 + bx_1x_2 + c{x_2}^2 = 0 \\

Solve for vector of coefficients based on constraints from perpendicular lines using SVD, then solve for homography from CC^{\star\prime}_\infty using SVD.

Q3: Planar Homography from Point Correspondences

Input images

Annotated images

Output images

Implementation

Hxi×xi=0Hx_i \times x_i^\prime = 0

[0wx yxwx0xx]h=0\begin{bmatrix} 0 & -w^\prime x^\intercal \ & y^\prime x^\intercal \\ -w^\prime x^\intercal & 0 & -x^\prime x^\intercal \\ \end{bmatrix} h = 0