CS 194-26 Final Project by Siddharth Karia (sidkaria@berkeley.edu)

Part A: Depth Refocusing

In this part, we are essentially mimicking a camera as it changes focus to different depths in an image.

I created an image grid of all the x and y shifts taken by the camera. I then went through a series of factor/scale values that scaled the shifts by a specific amount every time. Different shift sizes corresponded to different places in the image being focused on, since nearby objects were originally shifted more in the pictures than further ones. To do this shift, I did an np.roll on the x and y axis, and averaged out the final shifted images so that they are in the same position. This was done for each scale factor / step, and outputted as a gif.

The following are compressed gifs that may not be extremely detailed, as I had to fit them in the 25mb upload limit.

Bracelet:

This is a gif of depth refocusing on from closer parts to the farther parts of a bracelet (mind the blurriness at the end; I just let it go on too long).

Lego set:

The lego set displays the depth refocusing imitation quite well, too. It focuses on closer objects and scenery, and moves toward the background.

Part B: Aperture Adjustment

This part was similar to part A, but required us to focus on the same point, and simply adjust the "aperture size" to let in or not let in light.

To mimic this, I created the same image grid as before, but this time not shifting the scale factor as we go through the gif. Instead, we change the aperture size, or width, to be more narrow or more wide, while focusing on the same point. We only choose the x,y images in our image grid that are inside our aperture's radius, and we only shift those.

This results in wider apertures / greater sizes making the scenery around our point more blurry and less focused on (as we are shifting the entire image grid). The narrower apertures, with smaller sizes in the gif, are focusing on a very small subset of image shifts (sometimes even just one image), making the entire scene sharp and visible.

Lego set:

Gif of narrow to wide aperture:

Gantry:

Gif of narrow to wide aperture:

Chess:

Gif of narrow to wide aperture: