CS194-26: Image Manipulation and Computational Photography Fall 2018
Maddie Pahati, cs194-26-abz

Project 5: Lightfield Camera
Depth Refocusing and Aperture Adjustment with Light Field Data


Overview

In this project, we aimed to manipulate photos after they have been taken such as changing the focus and aperture by means of shifting and averaging images using datasets from the Stanford Light Field Archive. These datasets include 289 images of an object taken at different angles with little displacement which were captured by 289 cameras constructed in a 17x17 grid.


Depth Refocusing

By shifting all the other images with positional coordinates (u,v) to align to the center image at position (8,8), we can refocus an image at different depths. I calculated the proper shift amount using the following formula, where C is a constant chosen with experimentation.

shift_amt = C[(u,v) - (8,8)]

Naively blending all the images together by simply averaging them together produces an image that is sharper in the background where far-away objects are more in focus and blurrier in the foreground where closer objects are not in focus. This is because objects farther away do not vary their position as significantly as objects closer to the camera as the camera moves along the 17x17 grid.

Naive Lego Naive Tarot
Naively Blended Lego Knights           Naively Blending Tarot Cards and Crystal Ball

The following are the result of using different weights from an interval C[a:b] with a step size of 0.5 to refocus on the image at different depths. A large positive C will focus on objects farther away from the camera, and a large negative C will focus on objects closer to the camera.

C[-4:4]                      C[-3.5:2]

Aperture Adjustment

Changing the aperture requires that we only include a select amount of images within a specified radius and then average that subset of images together. A smaller aperture results from a small subset of images, and consequently, a larger aperture results from a large subset.

Aperture

As you can see with the two extremes, restricting the radius=0 produces just the center image of focus, which is the image at (8,8), and increasing the radius to be 12 averages all of the images, which is equivalent to the naively blending images in the previous part.

The resulting gifs were created by increasing the radius from 0 to 12 in increments of 1.


Reflection

This project was really fun to do! I learned a lot about lightfields and how images can be manipulated after-the-fact. There is just so much depth to an image that the possibilities of what we can do seems endless!