Project 5: Light Fields

Vivien Nguyen || cs194-26-afd


Overview

In this project, we play with a dataset from the Stanford Light Field Archive. This dataset consists of several sets of 289 images each. Within a set, the images are of the same object, but captured from cameras arranged in a 17x17 array. Thus, each camera is in a slightly different position. This means this multi-camera array helps us to simulate a lightfield, and allows us to create various effects that would otherwise be "lost" once the photograph had been taken.

Part 1: Computational Refocusing

We first pick a reference image, which is the center of the multi-camera array. We can think of this as the center of the main aperture. We then calculate the distance between this center image, and each of the other images in our set. We then scale this distance by some alpha value, and shift that image by that amount. The magnitude of alpha determines the distance from the original, physical focus, while the sign of alpha determines whether we are shifting closer or further.

This is the implementation of the very simple "shift and add" algorithm, which takes advantage of the fact that each camera was at a slightly different physical location, so shifting each subaperture image will "stack" a certain object in the scene. This "stacked" object will be the one in focus, while the others that aren't overlayed will be blurry.



alpha = [-.1, .3]


alpha = [-.34, .06]


alpha = [-.1, .3]


alpha = [-.1, .3]

GIFs (in case interactive sliders don't work)

Part 2: Computational DoF

Next, we can simulate changes in our depth of field, by computationally modifying the aperture of our camera. When we have a larger aperture, we have a shorter depth of field -- a smaller range of objects is in focus. When we have a narrow aperture, we have a deeper depth of field -- most or all of the objects are in focus.

We can simulate changing the aperture size by selecting which images from our dataset we will average into the final image. Again, we can fix a center point (such as [8,8]), and take an increasingly growing radius of images around that point. Note how this differs from the refocusing: rather than sweeping the focal plane through the scene, we fix a part of the scene to be in focus, and "increase" the defocus in the other planes.

Fixed at [8,8]
Fixed at [0,8]