Project 5: Lightfield Camera

Yena Kim - cs194-26-aax




Overview

In this project, we use images taken by a light field camera to digitally refocus and image and change its aperture. The light field camera produces images taken over a regularly spcaed grid. This means that the images were all taken from a different position and angle. By shifting and averaging these images, we are able to change the focus of a scene as well as mimicing cameras with different apertures.

Depth Refocusing

In order to change the focus of an image, all the images need to be shifted based on their distance from the center image. Since these image sets are taken over a 17x17 grid, the center image is at (8, 8). I found the differences between the camera position of each image and this center image. I then shifted each image by the corresponding difference in camera positions scaled by alpha, which determines the depth of focus for the final image. After I shifted all the images, I averaged them all together to get the final image, which has a different depth of focus depending on alpha.

Below, I show the results of different alphas.

amethyst alpha = -1
amethyst alpha = 0
amethyst alpha = 1
chess alpha = 0
chess alpha = 1
chess alpha = 2

Below are gifs that show the different depths of focus with alphas ranging from -3 to 3.

amethyst alpha = [-3, 3]
chess alpha = [-0.5, 3]

Aperture Adjustment

In order to mimic a camera with different aperture sizes, I changed the number of images I was averaging over. I used less images to imitate a smaller aperture, resulting in a sharper image. On the other hand, averaging over more images means more blurring, which mimics a larger aperture. The images for each aperture are in the square grid with a side length of radius x 2 + 1, with the grid being centered at (8, 8). The smaller radius correlates to a smaller aperture.

Below, I show the results of different radii.

jelly beans radius = 0
jelly beans radius = 2
jelly beans radius = 6

Below is a gif that shows the different depths of focus with radii ranging from 0 to 8.

jelly beans radius = [0, 8]

Summary

I learned that with the images taken from a light field camera, it is possible to change the depth of focus and the camera aperture size. There is a lot of data stored within these images, and there is so much you can do by simply shifting and averaging the images together in different ways.