This is some basic, sample markdown.
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.
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.