Project 5: Lightfield Camera

Depth Refocusing and Aperture Adjustment
CS 194-26: Image Manipulation and Computational Photography, Fall 2018
Cody Zeng, CS194-26-AGP

The objective of this project was to create the illusion of 1) focusing on different parts of a light field image and 2) increasing the aperture (decreasing field of view), by taking the individual light field camera images, taking the middle camera's image, and shifting all other images in relation to this middle image, and averaging several images together.


Depth Refocusing

Depth refocusing was accomplished by taking the middle camera in the light field setup (8,8) taking the coordinates of the middle camera (-818.578247, -3313.998047), and then taking the difference in coordinate values between the middle camera and every other image, and shifting every other image by this coordinate difference times a constant (which we call alpha), and averaging all images. The coordinate differences were multiplied by alpha in order to move every other image partially, as moving them completely would result in a image that would be too blurry. By moving them partially, the image looks clear in some area and blurry in others.

alpha of -.1
alpha of 0
alpha of .2
alpha of .4
alpha of .5
Transitioning from alpha of 0 to .5

Aperture Adjustment

Aperature adjustment was accomplished in a similar fashion to depth refocusing. However, instead of taking every single image and averaging them, we instead take a circle of cameras that are a certain radius from the middle (8,8) camera, and then average the images from the cameras in this certain radius. By saying that we take a radius of cameras, I mean that we take every picture's camera coordinate (u,v), where u and v both range from 0 to 16, and find the sum of squared differences and sqaure root that (sqrt((u-8)^2 + (v-8)^2)). If the value is less than the radius limit (which we vary), we include this picture in the average. We still use alpha (in our case .1), and shift each picture towards the middle camera image. By taking only a certain circle of cameras, we are in essence controlling the amount of light we are letting in (smaller circle = less light and bigger circle = more light). More light being let in corresponds to a larger aperture hole, and thus a smaller field of view. This results in the image looking like it focuses the center of the image and leaving the edges blurry. We can think of this as setting our camera to "portrait mode" or "macro mode".

Radius of 1
Radius of 2
Radius of 4
Radius of 6
Radius of 8
Transitioning of radius from 1 to 8