# Computational Photography Project 3: Michael Kamm (mkamm)

## Seam Carving

### Overview

For this project, I had to implement a seam-carving algorithm in MATLAB. Seam-carving is a method of image-resizing that takes into account the energy of each pixel of the image. It finds the path of lowest total energy that goes either horizontally or vertically and removes that "seam". This will remove the nonimportant parts of the image first and keep the shape of the more important part of the image.

To find the least important seam to remove, I used Dynamic programming. Starting from the bottom row, for each pixel, I kept track of the path of least energy from that pixel to a pixel in the bottom row, and also the total energy of this path. Then I found the pixel in the top row with the path of least energy and removed this path from the image. I then recalculated the energy function of this new image. I repeat this process for however many pixels I want to remove.

### Good/Decent Results

#### Shore of Rancho Palos Verdes

Original Image

Seam-Carved Image

#### Night Snow at Kambara

Original Image

Horizontal Seam-Carved Image

Vertical Seam-Carved Image

The border here got a little warped.

#### Castle

Original Image

Seam-Carved Image

#### Waterfall in Iceland

Original Image

Seam-Carved Image

#### Bob Ross Painting

Original Image

Seam-Carved Image

#### New York Skyline

Original Image

Seam-Carved Image

### Failed Results

#### 28 Days Later

Original Image

Seam-Carved Image

To my surprise, this image did not resize well from seam-carving. Perhaps it is because his shirt is a more constant color than the background building.

### Attempted Seam-Insertion

I tried to do seam-insertion by finding the n lowest energy seams in the image, where n is the number of seams I wanted to insert, and then duplicating them. I had trouble dealing with the offset of the seam in my carved image and the same seam in my seam-inserted image. But here are my results:

#### Castle Insertion

Original Image

Seam-Inserted Image

#### Waterfall Insertion

Original Image

Seam-Inserted Image

#### New York Skyline Insertion

Original Image

Seam-Inserted Image

The edges of important objects in each of these scenes are warped and fuzzy