CS194-26 Project 2 - Brian Chin

Part 1: Shooting the Pictures

I used the following images for the sample rectification.

I used the following images for the mosaics.

VLSB:

Monitors:

Pimentel Hall:

Part 2: Recovering Homographies

I recovered homographies by using the following equation reformatted so I could use least squares:

[w * x_prime, w * y_prime, w] = [a b c, d e f, g h 1] * [x, y, 1]

To get the values of the H matrix, for each coordinate in the correspondences, where x_prime, y_prime are the points of the source image and x, y are the points of the target image, we move around the system of equations and arrive at:

[x y 1 0 0 0 -x*x_prime -y*x_prime, 0 0 0 x y 1 -x*y_prime -y*y_prime] * [a b c d e f g h].T = [x_prime y_prime].T. We plug this into the least squares equation that minimizes the L2Norm of ||b - Ax||, where x is the flattened H matrix./p>

Part 3: Warping the Images

Warping involved piping the corners of image through H to get the boundaries of the mosaic. I made sure to get the accurate corners by dividing by the w value for each coordinate. I then populated the warped image with inv(H) * all coordinates defined by the polygon function using the new corners. Since there is mapping outside of the boundaries of the source image, I made sure to neglect those coordinates when populating (otherwise the boundaries are repeated). I also set up my warping function such that it would be easier to add the source image to when blending.

Below are my mosaic rectifications:

VLSB:

Monitors:

Pimentel Hall:

Part 4: Rectification Samples

Below are my sample rectifications:

Jennifer Doudna:

Apple Pencil:

Part 5: Blending

My blending algorithm keeps both images at full capacity for non-overlapping regions, and holds alpha banding for the overlapping regions, this smooths the overlapping region & the troublesome edges. The results of my mosaics are below with steps.

VLSB:

Monitors:

Pimentel Hall:

Part 6: What I Learned

I learned that it is incredibly difficult to achieve good or even decent results when manually picking out the corresponding edges. I also found great difficulty with warping, as I needed to make sure there were no index errors when projecting. I also learned firsthand the capabilities of linear algebra in image processing, and how we can map projections through recovering homographies.