I used a picture I took of the British parliament a little while ago. I wanted to make the side of the building be front-parallel so it looked like I was right in front of it.
I created my homography matrix H by solving the following overdetermined system of linear equations using the correspondances (x, y) to (x', y'). I solved the system using linear least squares.
I then warped my image by creating an inverse warp function H^-1, and then creating a polygonal coordinate mask that covered the entire image. I applied H^-1 to the mask, and applied to my rectified image the pixel values of where each coordinates of the transformed mask lay.
I got the following results: