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
-
Tread carefully. The autograder grades the regular project. These optional exercises may be disruptive to the autograder. You should create an entirely separate copy of your project to work on any “Out of Scope” exercises. It is YOUR responsibility to ensure you submit the right thing to the autograder.
-
Be patient and courteous. Our staff works very hard to be familiar with all course material and readily able to answer any questions you have. However, we do not officially provide support for these optional exercises, and not all staff may be familiar with them. We may also need to prioritize students with questions about the regular project if office hours are busy.
-
Be responsible. Do not jeopardize completion of the regular projects by working on these. Your grade is determined by your implementation and thorough testing of the regular projects! Do not skimp on testing your regular projects to work on these.
-
Have fun. These optional exercises are intended for your enjoyment and if you find yourself wanting more after finishing the regular project. But let’s be clear - these are not intended as a proving ground for advanced students, nor should you feel deficient if you do not implement them.
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 |