Programmatically implementing the tilt shift effect to create fake miniatures from a normal image. An experiment with focus lines, DOFs, edge preserving filters, and custom DOF regions.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
miniatures.py

README.md

miniatures

Programmatically implementing the tilt shift effect to create fake miniatures from a normal image.

Example

Background

The tilt shift effect is often used in architectural photography. The idea is to use a normal camera on small and medium formats, to create what would be a normal view into a "miniature view". To do this on a normal camera, you would rotate the lens plane relative to the image plane (giving the name tilt), and move the lens parallel to the image plane (giving the name shift). The problem with this is that it requires modifying your lens and you cannot backtrack what would be a normal image. The idea behind this project is to have this same effect, but do this post-algorithmically using a Python program.

Algorithm

The algorithm to achieve this effect is very simple. First we take the image and increase the saturation and brightness of the colors, giving a "dream like" feeling to the items in the image. After this, we programmaticaly determine how large we want our focus line to be, and thus generate a mask. After generating a mask we blend the outer layers using a Gaussian mask, and the proceed inwards until the image is clear. We apply this filter on top, thus giving our miniature.

Running the Code

Normal Mask

python miniatures.py <path/to/image>

Custom Mask

python miniatures.py <path/to/image> <path/to/mask>