CS 194-26: Image Manipulation and Computational Photography, Fall 2018

Project 4: Depth Refocusing and Aperture Adjustment with Light Field Data

Alan Nguyen, cs194-26-ags


Overview

The Stanford Light Field Archive contains datasets of images taken over a 17x17 grid. This project intends to implement algorithms that achieves depth refocusing and aperture adjustment over an image.

Part 1: Depth Refocusing

Naive Averaging

At first, naively averaging all of the images taken over the grid will yield a final image that appears to be focused towards the chess pieces on the back of the chess piece, and the rest of the image being a bit blurred out.


Refocusing

Turns out, we can shift the focus towards other parts of the image! As our reference image, we can pick the center subaperture (8, 8). For every other subaperture (u, v), we can compute this shift by the following equation: k[(u, v) - (8, 8)] for k is a constant. By shifting every image by this amount and averaging the result, we can essentially produce an image that has a refocused depth. I chose k = -0.3 to 0.3 with a step size of 0.1.

With the following images below, we can see that as k < 0, the image tends to be focused more towards the back. On the other hand, as k > 0, the image tends to be focused more towards the foreground.


k = -0.3 k = -0.2 k = -0.1
k = 0.1 k = 0.2 k = 0.3

Part 2: Aperture Adjustment

It is also possible to adjust the aperture of an image by carefully selecting a subset of images from the grid. In fact, this subset should consist of images that satisfy the following property: dist((u, v), (8, 8)) <= r for r is a set radius, and dist() is the distance formula between two sets of coordinates. As


r = 1.0 r = 2.0 r = 3.0
r = 4.0 r = 5.0 r = 6.0
r = 7.0 r = 8.0 r = 9.0

Summary

What I thought was really cool was learning behind the scenes on how we can shift focus on certain images based on lightfields and our shifting factor! It's interesting tinkering with the shifting factor and seeing how the depth of field changes from foreground to background, and vice versa. Furthermore, it was interesting digitally adjusting an image's aperture based on a subset of images from a lightfield and a constraint based on a set radius.