Project 6: Image Warping and Mosaics

Albert Phone

Part 1: Warping

For the first part, I took a couple photos of posters I own and some parts of Etcheverry Hall. I generally tried to use pictures which showcased an object at an angle and then the object straight on. I chose about 6-8 correspondences for each image. After finding H, with help from the stackoverflow post explaining what homographies are, I generated some warped images. Here are some before and afters:

After doing so, I rectified the photos against pictures in the same plane as them. Here are the mosaics of it:

Finally, I used my blending algorithm from project 3 to blend together the photos. As you can see, the first two blended well together, but it seems like the last one didn't work too well. I am guessing that it is because the mask that I chose for the blending portion didn't fit very well to the points I chose in the project.

What I Learned

I learned how to calculate homographies for H.

Part 2: Feature Matching for Autostitching

Part 2.1: Detecting corner features in an image

For this part of the project, I used the starter code provided in harris.py to just get left coordinates and right coordinates of a grayscale image. To make a grayscale image from the pictures I took, I found a StackOverFlow source dictating that the RGB values should be multiplied by 2.99, 0.587, and 0.114 respectively. I layered the dots ontop of my image. I chose to alter the min-distance to 25 because at 1, the dots just entirely covered my image.

Part 2.2: Extracting a Feature Descriptor for each feature point

I implemented the adaptive non-maximal suppression algorithm from the paper by calculating the distance between each point and finding the minimum distance for each point. After doing so, I chose the top 500 points as dictated by the essay. As you can see, here are my images again with the chosen dots to use on top.

Next, for the extraction, I followed the paper by choosing a range of 40 points around each point and resizing it to a radius of 8. Then I normalized the patch against the mean and standard deviation of the patch.

Part 2.3: Matching these features descriptors between two images

For each point and it's patch in my left image, I essentially calculated the SSD between that point and all other points in the right image. After doing so, I took the two lowest SSD's that I had calculated and took the ratio between them. If the ratio turned out lower than a threshold of 0.5 (as taken from the paper), then we know that there is quite a large difference between the two lowest SSD's, so the lowest SSD's match is the best one.

Part 2.4: Ransac

Like the guideline mentions on the website, I followed it's basic algorithmic structure with all of the feature matching points that I had generated. I selected 4 data points at random, obtained the homography given these 4 data points, and then compared the points transformed and checked if the SSD of that warped point and the second images points fit within my tolerance of 0.5. I kept track of the highest H with the highest number of inliers and used those inliers to compute my H for the final images. Below are my mosaics.

Finally, here is an example of my autostitching that didn't work out so well. The pictures I took were too far apart, so I believe the algorithm primarily mistook the TV for the frame when looking at the matching features.

What I Learned

I spent a lot of time trying to read and digest the paper. I think that took a significant portion of the work and actually coding wasn't very difficult. I learned a lot more mathematical reading skills because that's primarily what the article used to express all of the matrix operations we had to conduct and I definitely have a stronger understanding of all of the different algorithms we used for this portion of the project. I believe I could have definitely improved on the pictures I took. I tried approximately 7-8 examples but most of them did not really feasibly output a good panorama. I think it is because of very basic details laced in the pictures so it was hard to clearly match it through the algorithsm used.