CS194-26 proj 5

Part One

Rectification

In this part of the project we rectify images by computing a homography \(H\) from the input points to a rectangle. I then apply this homography to the bounding box of the image to find the bounding box of the output image. I then calculate the inverse homography matrix by taking the pseudoinverse of a translation times \(H\). I then applied an inverse warp with bilinear interpolation.

Original Image
Original Image
Output Image
Output Image

Image stitching

For this part, I stitched images together using a homography on defined points. I feathered by weighting each point by a center score. This is calucluate by linearly scaling a value from 1 to 0 from the center to the edge of the image.

Hand stitched Image
Hand stitched Image

Dank. I used haskell for this project. I thought using least squares to find \(H\) was pretty neat.

Harris corners

I used haskell for this project, because I am a masochist. Because of this, I had to implement harris corners myself. It was, in fact, a thankless task. But it was kind of interesting as I now kinda understand how this works. To implement harris corners, there is a step where you have to smooth a matrix valued function with a gaussian. To do this, I stored the values of the matrix as the RGB channels of an image and used a built in convolution function. This made computation efficient. I then limited the corners to ones that were the local maximum in its 3x3 region.

Harris Corners
Harris Corners

Adaptive non maximum supression

I didn’t do this lolol

Feature extraction

For each corner location, I took a 40x40 region around it, applied a gaussian, and then downsampled it, and normalized it to be between zero and one.

Feature matching

For this part, we flatten each feature into a vector. I implemented the fast distance formula in haskell. I then found the sum of squared distances. For each correspondance, I found the sum of the squared distances. I limited the correspondances to the ones where the sum of the squared distance of the best match was one fifth or less of the next highiest one.

Ransac

I applied the RANSAC algorithm with 1000 iterations. In each iteration, We computed a homography with four randomly selected points. Then, I counted inliers, which were points that were 3 pixels away from their actual correspondances. I then calculated the final homography with the inliers. Here are the correspondances of one of the final panoramas.

Correspondances
Correspondances

Results

Left
Left
Right
Right
Pano
Pano

Here is a Pano with 3 images from the dataset given

Pano
Pano

And this is another one of my house

Living Room
Living Room