CS 194-26 Project 4 Part 1: Image Warping and Mosaicing

Shoot Pictures

Here are some amazing images I took in my apartment for this project(a few are not included). I took these with my phone which was not ideal, but I tried to make sure that the exposure and focus were consistent by using the iPhone's convenient AE/AF lock feature.

Zagreus from the game Hades as my background
This pepper shaker I found on my table
I am Groot
I am Groot
This map from a puzzle hunt.
Shiver me timbers

For each of these pictures I had to pick points so I could rectify, or warp them in different ways

Recover Homographies

To find the homography, I needed two sets of corresponding points, and I used them to perform least squares to find the matrix that best fit all the points that were selected. The matrix that I used to find the homography is shown below.

Courtesy of this website

I was able to use these concepts to rectify images so that a plane that may not seem straight in a picture will be warpped so that plane becomes the frontal-plane. Below are some examples of what I looks like. These pictures may not seem perfect, and this is because I am bad at picking points, and the pictures themselves are not high quality.

Original Zagreus
Rectified Zagreus
Original Pepper Shaker
Rectified Pepper Shaker

Blend Images into a Mosaic

Using these homographies, we can stich images together to get one completed image. I used the function morph.distance_transform_edt from the scipy package to create a mask to blend the two images together smoothly to get rid of harsh lines between images. Below you can see a few examples of mosaics. Again, if I picked my points more carefully I am sure I would get results that look better.

I am Groot
I am Groot
I am Groot
Left side of the map
Right side of the map
Full map to find treasure

The next one is a little different becuase I stitch together 3 images, which got a little funky when the third image got thrown in there. I think that the way the third image is being blended is incorrect.

Left side of dragon
Middle of dragon
Right side of dragon
Waw full dragon

What I learned

During this project I learned alot of things. I learned that I should not try to use Jupyter Notebook because apparently my laptop does not like working with large matrices, and ipython just makes it worse. I had to downsize my images by a foactor of about 6 to get my laptop to not crash when running these programs. I also learned that picking points carefully and being extremely consistent is very important when warping images and recovering homographies.