A macro lens can deliver incredibly shallow depth of focus — an effect often seen when photographing very small objects. We can simulate this effect by Gaussian blurring parts of an image, leaving one area unblurred.
In this project, I created a program that allowed me to define an upper
and lower bound for a depth of field (a horizontal stripe of the image).
Then, I created a Gaussian pyramid of l = 5, sigma = 2
, as in
Project 3.
I iterated through all the pixels, checking its y-coordinate, and using a hashing function to decide which layer of the Gaussian stack I would sample from to fill in that pixel. The further from the DOF, the blurrier (higher up the pyramid). To get rid of harsh edges, I used a mask to blend with the original image. Since the DOF area should be not blurry, the alpha mask has a low value that linearly increases from that DOF.
The dolly effect can be recreated by taking photos of a subject at different distances with different focal lengths on a zoom lens. The key is to keep the subject in a constant position and size within the frame. I did this by moving backwards while zooming in on the lens.
An extra step I took was to align all the frames in Photoshop to make the subject as "still" as possible. This helped make the GIF animation much more realistic and appealing.