In this project we will take advantage of pictures taken with light field photography in order to refocus pictures by combining the results of all the photos shifted by a particular amount.

We parse the photos taken from the Stanford Light Field library and get the u and v values from the image metadata. Then, we can compute dx, dy = C * (u, v), and shift each picture according to that calculate displacement. The C value controls the degree to which the images are shifted, which changes the focal region of the image.

Depth Refocusing

For the first part we refocus a chess board, varying C from 0.0 to 0.6.

chess
Chess board

Then we do the same for series of gemstone images, shifting C from 0.0 to 0.25.

gemstone
Gemstone

Same thing for a series of lego man images, shifting C from -0.3 to 0.5.

lego
Lego men

Aperture Adjustment

In this part we will mimic the adjustment of aperture by varying the number of images averaged into the final image. Aperture is the window size of light allowed into the camera, so we take a small aperature to be just the center image of the light field. A larger aperture would be a larger grid of images, which can be 3x3 or 4x4 and so on. I will use a radius measurement on the grid that includes an image I(i, j) if (i, j) is within R units of (9, 9).

First on the chess pieces, we simulate changing the aperture from R = 0 to R = 9.

chess
Chess pieces with increasing aperture size

Then, the same thing for the tarot cards.

tarot
Tarot cards and ball with increasing aperture size

Conclusion

This was a very interesting exploration of photography principles and allowed me to get a much better understanding of how cameras operated. Concepts like aperture and depth of field were big players in how the final products were created, and I'm glad I got a chance to understand and appreciate the technical subtleties of photography.