CS 194-26 Project 5: Lightfield Camera (Depth Refocusing and Aperture Adjustment with Light Field Data)

Christine Zhou, cs194-26-act

In this project, we use data from a lightfield camera to generate images with different focus points as well as images that look as though they have been taken with varying aperture sizes.

Throughout this project, we will be using image data from the Stanford Light Field Archive, which uses a 17x17 grid of cameras to capture all the data.

1. Depth Refocusing

Using the light field archive data, we can generate images that look as though we are focusing on different parts of the image. We do this by using the names of the images provide in the Stanford Light Field Archive. The image names are in the format out_r_c_u_v_.png, where r is the row index, c is the column index, u is the actual row location, and v is the actual column location of the camera taking the photo.

Then, we choose the middle camera in the 17x17 camera (located at position (8, 8)) to calculate all the offsets. For each other camera, we use the (u, v) coordinates given in the image name and subtract that value from the center camera's (u, v) value. Once we have the offset, we multiply the offset by some constant and shifting the image's pixels by this calculated offset. This is done in order to "refocus" our image; we are shifting the magnitude of the offset very slightly in order to take advantage that all the cameras took the image from a different perspective and "center" the image on a different center.

Images using a constant of 0, -0.5, and 0.1 are shown below, as well as a GIF of images using constants from -0.5 to 0.1.

chess-c0

chess-negative

chess-positive

chess-refocus

2. Aperture Adjustment

To mimic the effect of having a larger or smaller aperture on our camera, we will average more or less images together respectively. We will choose a radius around the center camera, and including images from a radius of 1 around the center will result in a clear image and the effect of a smaller aperture. Including images from a radius of the entire grid of cameras (8 for our 17x17 grid) will result in a blurrier image and the effect of a large aperture.

Images using a constant of 0 and a radius of 1 and 8 are shown below, as well as a GIF of images using radii from 1 to 8.

chess-r0

chess-r8

chess-aperture

3. Summary

This was a really cool project! I learned that even with very simple operations such as averaging and finding offsets, we can produce images that mimic a camera's refocusing feature and different aperture sizes.

Here are two more GIF's representing the refocusing of and the aperture change of a bracelet.

bracelet-refocus

bracelet-aperture