Project 5 Part A:

This is some basic, sample markdown.

Algorithms

I started with the equation Hp = p' to see how to create the matrix A and solve for Ax =b. I noticed that I could rewrite Hp = p' as 3 separate linear equations.

ax + by + c= x'

dx + ey + f = y'

gx + hy + 1 = 1

Using this idea I made each row of the matrix A an equation by giving it 8 columns. For the first row, the corresponding b element was x', and the row in A was x, y, 1 followed by 0s. The second row was three zeros followed by x, y, 1 followed by zeros with corresponding y'. The last row follows the same pattern. By doing this for each point, I solved the least squares equation of Ax = b to get the homography and converted it back to a matrix.

After obtaining the homography based on predefined points, we can begin image warping. The way that I approached this was to use inverse warping. I first computed a bounding box for the transformed image. Then, I created a matrix of each pixel of the bounding box and multiplied it by the inverse of the transformation. For each of these points, I used cv2's remap to get the linearly interpolated pixel value from the image.

For rectification, I simply picked 4 points that I approximated to be rectangular, and guessed another 4 points to be a rectangle on the new image. I computed the homography and then applied the warp.

Images

temp

Picture of left side of room

temp

Picture of middle of the room

temp

Picture of the right of the room

temp

The left side of the room projected onto the corresponding points of the middle of the room. It cuts off the side of the room where points were not selected, which needs to be fixed. Better points should be selected and image mmight need to be shifted.

temp

Rectifying the wall of the left side of the room. Only the wall is made a rectangle while other features seem to still be at an angle.

temp

Rectified the wall in the middle of the room. Still seems to be at a slight angle, so better points might need to be chosen.

Improvements

The warp to the features of the image to the middle of the room could use some work. I think this was due to me guessing the pixels in a not very systematic way. In the future, I will attempt to use ginput to better pick correspondance points such that the entire image is viewable.