I shot two photos of my apartment hallway such that the transformation between them is projective.
To perform rectification, we need four correspondence point such that we can compute the Homographic matrix H. I used the four corners of the window at the end of the hallway as my points of correspondence.
We warp the image by using inverse warping, utilizing the matrix which we just solved using the least square method. We can see that the wrapped image looks like as if it was taken from another angle. This is how we rectify an image. All areas of the black part are places where we do not have information captured(no pixels in the source image)
Now we can use our result to create an image mosaic.
First we warp to two source images Then we put it together