Project 5: Lightfield Camera

Alexander Stennet, cs194-26-agn

General Appraoch

The key premise of this project is to take advantage of parallax to adjust the focus or aperture of a photo after it has already been taken. Taking many photos of slightly different positions allows us to get a sense of the depth of objects in the scene. Objects that move more when the camera moves are closer. Objects that move less when the camera moves are farther; therefore we can intelligently merge these photos together to by aligning different points of the image to alter the focus and aperture..

Depth Refocusing

Simply averaging the images without any change gives this result:


Now what we can do is take the average of the images but shifted by varying amounts in order to get different depth focuses:


The exact methodology is to take the center image coordinates (8,8) and use its difference from other coordinates to recenter them. If you take arbitrary coordinates (x,y), then you would want to shift them to the center by the difference of the coordinates (x-8,y-8). This, however, will only give one focus; instead, it is possible to further specialize the focus by multiplying this difference by a constant, C*(x-8, y-8) allowing for more variability of focus.

Aperture Adjustment



Now, instead of simply averaging all images, averaging a subset of images allows for a simulation of the change in aperature of the image. For example, averaging just a couple images near the center of the coordinates will give a more focused image than also averaging images farther away. Using a calculation of the distance from the center we can add images that are less than a specified radius in to the mean. Specifically, the output image will be avg({im[x,y] if |(x,y)-(8,8)| < r}). Flucuating this r value gives variable aperature focus.

More examples

Refocus on left, aperature on right