CS 194-26 FINAL PROJECT

Zachary Dehkordi (adl) and Matthew Sie (aep)

Project 1: Fake Miniature

To implement this we first used ginput to come up with the focus line and in turn manually choosing the size of the depth of field. From there we applied a gaussian filter on a masked version of the image which did not include anything in focus. We continually filtered the masked image increasing the size of the mask each time, until there was nothing left to filter.

Original

Fake Miniature

Project 2: Seam Carving

Energy Function

The first step of this project is to define an energy function, which gives each pixel a corresponding energy value. Drawing inspiration from other papers and projects, we decided to implement a Sobel operator in order to give greater weight to pixels on the edges of objects/subjects in the images, so these pixels are less likely to be removed as part of a minimum seam. We apply a Sobel filter on the provided image in both the x- and y-axes and sum these values to obtain the energy representation of the image.

Finding Minimum Seam

Once we have the energy representation of the image, we find the minimum seam using Dynamic Programming. Essentially, we construct a Dynamic Programming matrix, where each entry represents the corresponding pixel in the original image and the minimum total energy through pixels to get to that point from the first row of the image. Simultaneously, we build a matrix of all the minimum seams for the pixels in the last row where the value in the corresponding pixel’s entry is the index of the minimum pixel in the previous row adjacent to the current pixel. The minimum seam, then, is the seam that begins in the pixel in the last row with the lowest value in the Dynamic Programming matrix.

Removing Minimum Seam

We then remove the minimum seam that was found by creating a mask. The mask is the same size as the image and has the value of True in all the pixels except those that are a part of the minimum seam. We take all the pixels in the original image that have a corresponding value of True in the mask matrix and reshape it to an image with dimensions of one less column than what it was before. Additionally, we do the same thing for the energy representation matrix.

Running the Algorithm

We repeatedly find the minimum seam and remove the pixels from the image and the energy representation matrix until we reach the desired dimension reduction. The default algorithm removes vertical seams; if we want to remove horizontal seams, we rotate the image before running the algorithm.

Results

Below are results for both horizontal and vertical seam removal. The specified dimension was reduced by 75% in all examples. Most of the examples were fairly successful; we came across failures involving people (particularly when wearing dark clothing) and in landscapes or buildings that have a line pattern to their architecture (like the seats in the Memorial Stadium image).

Original

Horizontal Seams Removed

Vertical Seams Removed

Reflections

This project was particularly helpful for us in practicing implementing a Dynamic Programming algorithm. It was also cool to see the effect on the composition of the images once seam carving was applied - some examples produced interesting new image compositions!

Project 3: Vertigo Shot

The Method

Camera Used: Canon EOS 6D

Lens Used: Canon EF 28–135mm

Location: Home

We began by zooming the lens all the way and stood as far away from the subject as possible while keeping it in the frame. We, then, iteratively zoomed the lens out slightly while stepping closer to the subject, in order to keep the subject in the same position for all the images. Doing this several times produced a sequence of images mimicking the “Dolly Zoom”.

Difficulties: The primary difficulty we encountered was trying to keep the subject in the same location of the frame across all the images. We attempted to do this more accurately by using the grid feature on the camera, using both the 3x3 and 6x4 grid overlays. Still, there were slight imperfections in consistency across the images.

Sequence 1 - The Iron(y) aka Hot Metal

GIF (BELLS AND WHISTLES)

Sequence 2 - The Ball

GIF (BELLS AND WHISTLES)