Lightfield Camera

Depth Refocusing and Aperture Adjustment with Light Field Data

In this project, I used light field data to focus on an image at different depths and simulated a change in aperture size.

Depth Refocusing:

Depth refocusing using light field data allows us to take an image and refocus it at any depth we wish as if we specified a certain depth of focus when we captured the image. To do so, we shift image as so: we take the distance between the image and the predetermined center image and multiple it by a scale. This change in scale determines which elements in the scene are in focus. Once we've shifted all the images accordingly we average them out for the final result.

Gif of the depth refocusing for jelly beans (scale -1 to 1 with a step of 0.2)

Aperture Adjustment:

We can also simulate a change in aperture size using light field data by only averaging the images that are within a certain radius from the cente. So the bigger the radius, the more images we average out, and the wider the aperture will be, creating a blurrier image.

Gif showing an increase in aperture size for the jelly beans

Final Thoughts:

I really loved this project because it shows how you can easily manipulate the characteristics of an image even after capturing it using simple algorithms.

Seam Carving

In this project, I learned how to implement vertical and horizontal seam carving of an image which shrinks an image to a desired dimension by removing the least "important" parts

In order to do this, I generated an energy function which calculates a pixels' energy using 2d convolution. Then I find the vertical or horizontal (depending on the desired output) seam that has the lowest total energy and remove it. This ensures that the seams of the image with the "least going on" are removed and that important artifacts are kept (up to a certain point). I wanted to try this with images I took on some of my trips to Croatia, Los Angeles and Mexico so here are the results! Some are better than others:

Original Image of my photograph of a building on the island of Hvar, Croatia
Vertical Carving of my photograph of Hvar, Croatia. As we can see the top corner of the building flattens a bit, which is one issue with the seam carver algorith
Original Image of my photograph of Hvar, Croatia
Vertical Carving of my photograph of Hvar, Croatia. It successfully reduced a lot of the unnecessary blue sky!
Original Image of my photograph of a market in Split, Croatia
Horizontal Carving of my photograph of a market in Split, Croatia. As we can see the result is not the best because the image itself is so busy so the algorithm is forced to carve out many essential artifacts that make the image appear realistic.
Original Image of my photograph of kayaking in Dubrovnik, Croatia
Vertical Carving of my photograph of kayaking in Dubrovnik, Croatia. The result is beautiful and removed a good portion of the sky and water.
Original Image of my photograph of hiking in Los Angeles
Horizontal Carving of my photograph of hiking in Los Angeles. This gave great results: even though the bottom half of the image is very busy and I did a horizontal rather than a vertical carve, the output came out clean and realistic!
Original Image of my photograph of a town in Southern California
Vertical Carving of my photograph of a town in Southern California. The results are great: It removed a lot of the sky and the proportions of the cars did not get weird.
Original Image of my photograph looking out of a plane.
Horizontal Carving of my photograph looking out of a plane. The results are great: the plane's wing looks thicker but does not look deformed.
Original Image of my photograph of the Cobá ruins in Mexico
Horizontal Carving of my photograph of the Cobá ruins in Mexico. As we can see, the horizontal carving works well until we deal with humans and then they become stick-figure-like.

Final Thoughts:

I also really loved this project because I could take my own images and reshape them horizontally or vertically with minimal distortion.