15-463 Project 2: Focus on Miniatures

David Klionsky


The task for this project was to simulate a "tilt shift" lens effect, making normal photos look like pictures of miniatures. Tilt shift achieves this effect by putting only a small region of the image in focus, creating the same blur effects that can be seen in photos of miniatures.

The program takes as input an image and a height in pixels for the region that should be in focus. The user then specifies two points for the focus line, outlines a complex region of the image that should stay in focus, and outlines a region of the image that should be out of focus. The algorithm then masks the part of the image that should be out of focus and progressively blurs it, contracting the mask with each iteration so that the image smoothly transitions from sharp to blurred. As a final step, the saturation of the image is increased slightly, to enhance the miniature effect.

I found that defining a complex depth of field region significantly improved the realism of the effect. In an actual tilt shift photo, all objects that have their base on the focus line should be entirely in focus, and simply keeping a band across the image in focus while blurring the rest ignores this. Good examples of complex depth of field regions can be seen in the first sample image and the second image from Flickr.


Results (click for full size)

Sample images

     
     
     

Photos I've taken:

     
     

Images on Flickr, taken by users wufgaeng against censorship and reurinkjan:

     
     


David Klionsky, 2/8/2010