Overview

With a single photo, it is almost impossible to recover depth information. However, it is still possible to fake refocusing effect with blurring techniques. We can create a special type of art called fake miniatures (a prolific flickr topic) by simulating the effect of selective focus cameras, also known as Tilt Shift.

Idea behind algorithm

To make objects on the photo look like miniatures, we need to make the object in focus clear while surrounding areas blurry. This fakes the distance between lens and the object. To make this gradual blurring effect, we calculate the distance between the object and every pixel, denoting as d. Then using d, we parametrize the blurring to make further scene blurrier than closer scenes.

Note, we implement a general method to make fake miniatures instead of first making the line focusing then making irregular mask method. The logic is very obvious: if we can have a method for any shape, there is no need to specifically to write a routine for expanding the line to a rectangle and perform the calculation. So our implementation includes bells and whistles automatically.

Also note we define out mask simply by choosing vertices of the polygon. You can see the mask by observing the blue dots on the photo.

Original picture

Original picture

Mask1 - irregular

Mask1 - irregular

Fake Miniatures 1 Mask1 - linear

Fake Miniatures 2

Fake Miniatures 2

Original picture

Original picture

Mask1 - irregular

Mask1 - irregular

Fake Miniatures 3 Mask1 - linear

Fake Miniatures 4

Fake Miniatures 4

Original picture

Original picture

Mask1 - irregular

Mask1 - irregular

Fake Miniatures 5 Mask1 - linear

Fake Miniatures 6

Fake Miniatures 6