CS 194-26: Project 5

Lightfield Camera: Depth Refocusing & Aperture Adjustment

Karuna Wadhera, CS194-26-abo

Lightfields provide us with much more data than what just a single image can provide. The Stanfurd Light Field Archive has datasets taken with a grid of 17 x 17 cameras. We use this extra data to help us create images with different focus points and to simulate images taken with different camera apertures.

Part 1: Depth Refocusing

If we were to take all of these images and average them (as seen in the first image below, with C = 0), we would get an image which focuses on the far away objects in the image because those are displaced by a smaller amount in total for all the 17x17 images. In order to get an image which focuses on another region (the center, let's say), we would want to make sure we "pin" the center and align all the images such that their centers all "stack up". This means that the "pinned" center won't be displaced much when we take the average of all these stacked images. Instead, the other areas will be displaced more. Thus, the resulting image seems to focus on the center.

Doing this required shifting each image by some constant C multiplied by the difference of the floats given in the image name by the floats given in the center image's name. The results of changing this constant C are shown below.
And here is a link to a gif I made that showcases this depth refocusing.
C = 0
C = -0.1
C = -0.2
C = -0.3
C = -0.4
C = -0.5

Part 2: Aperture Adjustment

Note that images taken with smaller apertures have a wider depth of field, meaning that more of the image is in focus. Images taken with larger apertures have a smaller depth of field meaning a smaller part of the image is in focus.

So, in order to prevent as much blurring as comes with averaging all the images, we can just average a smaller amount of images such that those that we do average are closer to the center. This will get us images with a smaller aperture.

Below, the first image (where we only use the center image) has the smallest aperture. The last image (where we use all the images) has the largest aperture.

I held C constant at -0.2 as that's where I wanted to focus the image.
And here is a link to a gif I made that showcases this aperture adjustment.
Used center image only (1x1)
Used 3x3 images closest to the center
Used 5x5 images closest to the center
Used 7x7 images closest to the center
Used 9x9 images closest to the center
Used 11x11 images closest to the center
Used 13x13 images closest to the center
Used 15x15 images closest to the center
Used all the images (17x17)

Part 3: Summary

After taking CS 184 last semester, I had learned that refocusing was possible if we had Lightfield data, but it was never clear how it could be done. I didn't think that it would be something I would be able to do with such ease. I'm really glad we got to experiment changing focus and simulating different aperture sizes with this project!