p2-cv

Reach Goals

These are a set of optional exercises beyond the regular scope of project 2. They are essentially suggestions for additional features to add to the project if you find yourself wanting more. They are not required in any way, are not graded by the autograder, and do not contain new material that might show up on an exam. They are not worth extra credit.

The Rules

Growing Images

In the regular project, we only implement shrinking images. To grow images, we can use a similar technique, but there are some additional complications along the way. We’ll walk you through the high points here, but the rest is up to you!

First, make a completely separate copy of the project code. You don’t want to mess up the stuff you’ll need to turn in. Next, change the maximum matrix size to 1000x1000 so that we’ll have more room to grow our images. Your resize code will also need to allow larger sizes.

The big idea is that we’ll still find the lowest cost seam in the image (this is the least disruptive place to make changes) and duplicate it. Assume we’re working with a vertical seam. Each pixel along the seam is replaced by two side-by-side pixels, which result from averaging the original with its left neighbor and then its right neighbor. This increases the width by 1.

Unfortunately, we can’t just repeat this process until the image is the desired size. The problem (see below) is that the same seam gets chosen each time. Instead, we need to ensure that a sampling from the lowest cost seams are chosen - not just the absolute minimum each time.

To fix this problem, your algorithm needs to find the K lowest energy seams in the image, then duplicate the pixels involved in them all at once. Then repeat the process, increasing the size by some amount K each time, until the image is the desired size. Implementing this is tricky, but doable using the ADTs we have and some additional processing functions. You’ll also want to experiment with different values of K to find what works well.

Here are some examples of successfully enlarged images:

Original Image: 479x382

Resized: 479x600

Resized: 600x300 Pixels