Hanyin Cheng
Computational Photography

This is the first poster image This is the second poster image This is the original office image
This shows the result of putting poster 1 inside the picture frame on the right wall of the office image The way the code works is that first i select 4 corresponding points, in this case it is the edges of the poster and the 4 edges of the picture frame, where i want the picture to be transformed to. Then, the 4 points are used to compute the homography transformation matrix. Then i generate a meshgrid where the domain and range represent the x and y ranges of the the transformed poster. I use the homography matrix to make the transformation. I call this image the foreground. I then generate the background image by making a second meshgrid which consists of the office image but with the selected rectangle on the picture frame black. Finally I compose the final image by adding the foreground with the back ground. This shows the result of putting poster 2 on the wall of the office image. The process is the same as described in the other result example.