Final Project

Student Name: Divyansh Agarwal (cs194-26-aba)

Course: CS 194-26 (Computational Photography)

Fake Miniatures

Overview

In this project, we want to programatically replicate the Tilt Shift effect, which simulates a selective focus on a region of interest.

Process

I let the user select two points that define a horizontal or vertical focus line, as per the user's specification. The user must also specify how the half-width of the focus area. Once the focus line and half-width of the focus area is specified, I create a mask for the focus region. I blur the entire image, except for the masked region, using a Gaussian Filter, with the standard deviation of the Gaussian kernel being specified by the user. Then, I repeatedly increase the half-width of the mask by 0.5 * previous half-width of the mask, scaled the standard deviation of the Gaussian kernel by a factor of 1.1 each time, and blured the image with the new Gaussian Filter with the increased standard deviation. I carried this process out till the mask covered the entire image. Repeatedly increasing the size of the mask and the the standard deviation of the Gaussian kernel repeatedly helps create the effect of regions farther away from the original mask appearing more blurred.

I then increased the saturation of my fake miniaturized image by a factor of 1.5, to increase the illusion of a miniature.

Results - My Own Images

I applied these fake miniatures approach on some photos I've taken in the past.

Snow Hills at Point Reyes (Summer 2018)

Forest Fake Miniature

I set the half-width of my mask to be 80 pixels, and the initial standard deviation of the Gaussian kernel to be 2 for the result above.

Snow Another picture of Hills at Point Reyes (Summer 2018)

Forest Fake Miniature

I set the half-width of my mask to be 100 pixels, and the initial standard deviation of the Gaussian kernel to be 1.8 for the result above.

Snow Hoover Tower at Stanford University (Summer 2017)

Forest Fake Miniature

I set the half-width of my mask to be 80 pixels, and the initial standard deviation of the Gaussian kernel to be 1.8 for the result above.

Snow Evans Hall (Fall 2018)

Forest Fake Miniature

I set the half-width of my mask to be 80 pixels, and the initial standard deviation of the Gaussian kernel to be 2 for the result above.

An example with a vertical focus line:

Snow Palm Trees Outside my Hotel Room in Hawaii (Summer 2016)

Forest Fake Miniature

I set the half-width of my mask to be 60 pixels, and the initial standard deviation of the Gaussian kernel to be 1.5 for the result above.

Results - Images from the Internet

Snow Campanile

Forest Fake Miniature

I set the half-width of my mask to be 35 pixels, and the initial standard deviation of the Gaussian kernel to be 1.5 for the result above.

Snow Burj Khalifa

Forest Fake Miniature

I set the half-width of my mask to be 35 pixels, and the initial standard deviation of the Gaussian kernel to be 1.5 for the result above.

Bells and Whistles - Complex DOF and Edge Preserving Filters

I defined a complex mask, using user input. I used the starter code provided by Nikhil Uday Shinde for Project 3 this semester for creating the complex mask based on user input.

As before, I repeatedly increased the size of the complex mask and blurred the image with a Gaussian filter with increasing standard deviation for each repetition. I increased the size of the mask by taking the distance between each user-specified point on the boundary and the center of the mask, and pushing the points on the boundary outwards by a factor of 0.3 of this distance for each repetition. As before, I carried this process out till the mask covered the entire image. I then increased the saturation of my fake miniaturized image by a factor of 1.5, to increase the illusion of a miniature.

To improve the effect, I also used a cross-bilateral filter, which I applied to the mask. I applied this filter to the mask every time it was re-sized, and before the Gaussian blur took place.

The results can be seen below:

Snow Gateway of India

Forest Fake Miniature

The mask used for the result above is as follows:
Snow

Bells and Whistles - Fake Stop Motion

I went to Stanley Hall to capture some images of a road near Pimentel Hall from a vantage point.

Vertigo Shot

For this project, I re-created the dolly zoom effect. I took 3 sets of vertigo shots. For each set of shots, I moved behind, while increasing the zoom of the camera each time I went behind, such that the object remained the same size. I noticed that doing this led to the field of view of the camera decreasing every time I moved backward and increased the zoom. I used a Nikon D3400 camera, which is a DSLR, to capture the images.

First Vertigo Shot

This set of photos were taken in a room in Evans Hall.
Snow

Snow

Snow

Snow

Second Vertigo Shot

This set of photos were taken in another room in Evans Hall.
Snow

Snow

Snow

Snow

Third Vertigo Shot

This set of photos were taken in the living room of my apartment.
Snow

Snow

Snow

Snow

Bells and Whistles: Animated Sequences

I created animated sequences for my vertigo shot, and made them into the form of a GIF.

Bells and Whistles: Calculating Field of View

I calculated the Field of View of my camera at maximum zoom and minimum zoom respectively. Field of View is a measure of how wide a region a camera can capture while creating an image.

I computed the Field of View at maximum and minimum zoom for the second vertigo shot I captured. In order to compute the field of view at a given zoom, I needed two measurements: the distance from the camera to the object in focus (let's call this f), and the width of the object in focus (let's call this d). The field of view is then given by arctan(d/2f).

The width of the bag was 9.5 inches

At Minimum Zoom, the distance between the camera and the bag was 20 inches. This gave a FOV of arctan(9.5/(2 * 20)) = 13.36 degrees

At Maximum Zoom, the distance between the camera and the bag was 29 inches. This gave a FOV of arctan(9.5/(2 * 29)) = 9.30 degrees

What I Learned from these Projects

It was really cool creating fake miniatures and vertigo shots, and I learned how to create awesome illusions with math and code, as well as clever capturing of photographs. Over all, this class was very insightful and a great learning experience.