CS 194-26 Project 4

Kyle Hua, CS194-26-AGX

IMAGE WARPING and MOSAICING

Shoot Pictures

I shot various pictures using a Nikon camera from various angles. Some pictures are of my room and roomates along with some objects. In order to compute the homographies of the images, I selected similar points of interest between a couple of pictures and saved the points into a JSON file.

Selected Points

Recover Homographies

The 3x3 homography matrix H is the transformation matrix that transforms points from one image to another set of points as seen this equation: p′=Hp.

Expanding on this we get:

h11 x+h12 y+ h13=zx′

h21 x+h22 y+ h23= zy′

h31 x+h32 y+h33 = z

h33 is 1

We can then substitute z into the first two equations.

h11 x+h12 y+ h13= (h31 x+h32 y + 1) x′ → h11 x+h12 y+ h1 - h31 xx′+ h32 yx′ +x′ = x′

h21 x+h22 y+ h23= (h31 x+h32 y)y′ → h21 x+h22 y+ h23 - h31 xy′ -h32 yy′ = y′

Expanding on these equations we can build a system of equations up to N points. Below is an example of 4 points from each image. (Image sources: https://towardsdatascience.com/estimating-a-homography-matrix-522c70ec4b2c )

We can then use the least squares algorithm to solve for the H vectors.

Warp the Images

Once we have the homography, we can calculate the the new coordinates of one image in another images plane. Once we have the coordinates we can interpolate the pixel colors of our source image to the target plane. Here are some examples of warping angled pictures to a top down view (rectification)

Mosaic

With the projected images, we can create stich them together to make a mosaic. Here are some mosaics without blending.

Source Images:

Mosaics:

Source Images:

Mosaic: