Lightfields (CS 194-26 Fall 2018 - Project 5)

IVAN JAYAPURNA - CS194-26-ABT


Overview

This goal of this project was to take inspiration from Prof. Ren Ng's paper on lightfield cameras to reproduce some of the effects using real lightfield data - namely depth refocusing and aperture adjustment. The two image sets were taken from the Stanford Light Field Archive, which comprised of multiple images taken over a regularly spaced grid (17 x 17).

In this project I learned about the fundamentals of lightfields, specifically how to use them to reproduce cool camera properties!


Part 1: Depth Refocusing

In the first part of the project I averaged shifted lightfield dataset images to reproduce the camera effect of refocusing at different depths. As the results below show, by increasing in shift factor we can "focus our camera" deeper into the image, while decreasing shift (negative shift factor) gives a shallower focus (closer to observer).

My approach was to read in each image, and from the image file names compute shifts relative to the center of our evenly spaced grid. These shifts were done by rolling the images, the shifted images are averaged, and the average image returned.

Lego Knights - Shift factor range [-3, 4]
Tarot Ball - Shift factor range [-3, 2]


Part 2: Aperture Adjustment

In the second part of this project I reproduced the camera effect of changing aperture size. As aperture size (radius) increases, depth of field decreases, and thus although our plane of focus remains sharp, the rest of the image around it gets blurrier and blurrier.

My approach for this part was to use the same averaging of shifted images code from the previous part, but this time empirically selecting a fixed "optimal" shift (chosen for what I consider to be the prettiest GIF result), and introducing an additional conditional statement. This conditional statement only averages from images of within a specified radius of the uniformly spaced grid - a subset of the original grid of images - as calculated via Euclidean distance. Average images across increasing radius values have been converted into a GIF and shown below.

Lego Knights - Shift -1 - aperture radius range [0,10]
Tarot Ball - Shift -1 - aperture radius range [0,10]