



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Information about three homework assignments for the ece/cs 412 introduction to computer graphics course, fall 2008. Students are required to write programs for image resizing using bilinear interpolation, seam carving for content-aware image resizing, and photomosaic creation. The assignments involve writing code in c or c++ using visual studio and submitting the source code and an .exe version before the deadline.
Typology: Assignments
1 / 5
This page cannot be seen from the preview
Don't miss anything!




ECE/CS 412 Introduction to Computer Graphics, Fall 2008
Due Sunday, September 28, 2008 at 11:59pm
In this homework, you will get your hands dirty with 2D raster graphics, like we have been talking about in class.
1. Bilinear Resampling (30 pts)
You have been hired at Adobe to work on the new version of Photoshop. They want a complete re-write of their codebase, and you have been assigned the task of writing the new bilinear resampling for scaling images. This is the algorithm that will run on an image when the user selects “Image->ImageSize” and changes the size of an image using bilinear resampling.
You are to write a C or C++ program called LinearResample.exe that takes in an image in various possible formats and outputs it at a different size by using bilinear resampling. The executable should take in the following arguments:
LinearResample.exe
Where and
LinearResample.exe test1.tif 50 25 out.tif
Remember, the output image can be bigger or smaller than the original. The user can also change the aspect ratio. For example, one dimension can be increased while the other is decreased (see the examples below). Your program should produce an output that is visually comparable to that of using the bilinear resampling filter in Photoshop.
To help you get started, I provide you with a Visual Studio solution file called ImageProc which reads in and image and saves it back out as a different filename. This code uses the Windows CImage class to read and write image, but feel free to write your own if you want (although writing a function to read/write jpegs is probably not a valuable use of your time). You can also use any standard image I/O library if there is another you prefer
or if you want to do your coding on something other than Windows. Just make sure that your final submission compiles and runs on the Windows machines in the lab, so please test it there before you submit and include any of the libraries or dll’s you need. Also please note in the comments any code you borrow. You are not to use someone else’s code to do the actual filtering. In terms of the filtering, remember that you can use different convolution kernels for upsampling and downsampling of the image.
To submit: Just zip up your code and an .exe version and call it LinearResample.zip
2. Seam Carving (30 pts)
A popular paper from SIGGRAPH 2007 (and revisited again in 2008) was “Seam Carving for Content Aware Image Resizing” by Shai Avidan and Ariel Shamir. They describe a new way to change the resolution of images without scaling. The basic idea is that you can compute low energy “seams” that extend from one end of the image to the other. Since these seams contain little energy, you can remove them or duplicate them without affecting the appearance of the image. To change the aspect ratio, you can alternate between vertical and horizontal seams.
Adobe wants this to be a new feature in Photoshop CS4. Your task is to write the program SeamCarving.exe which allows you to resize images through the seam carving method. It should have the arguments as follows:
SeamCarving.exe
which are similar to that of the previous function. You can use the ImageProc code to get started.
To begin, you might want to read Avidan and Shamir’s seam carving paper, which is available off the class webpage. I recommend you compute the energy function by computing the image differential at every pixel as they recommend. Also be sure to implement the algorithm as a dynamic program since it needs to be fast. Users will not wait for a long time for their image to be rescaled! I will link some images to try on your algorithm from the class webpage. I also want you to try a few of your own images and see if seam carving works for them. It doesn’t work for everything so play around a bit with it.
Extra credit (20 pts): Write an editor to allow you to adjust the “energy” of images like I showed in class so that you can remove objects from a scene. Basically, create a mouse driven interface that lowers the energy of a particular region, forcing all the seams to pass through it. You might want to add the option of saving out this energy map into a file so another user can try it. Demonstrate that it works by editing a few images.
Extra credit (20 pts): Read their new paper (“Improved Seam Carving for Video Retargeting” by Rubinstein et al.) and implement their “forward energy” approach to minimize artifacts.
The final mosaic: To generate your final mosaic, set the size of your miniature images to 256 x 192 pixels. Also, make sure that your cells are big enough so that you don’t have too many of them in a single image. For example, in my test image below had 52 x 88 mini images, which yielded a final photomosaic of 13,312 x 16,896 pixels in resolution. To save this out, I had to use the saveToBMP() function call provided in the Image class. This image is simply too big for CImage to handle! Also, if your image gets much larger than this you will start running into memory problems, so be careful. Note that all submissions become property of AGL.
The contest: I will judge the final mosaics and select the best one to create a poster for display outside the AGL. Check out last year’s winner outside our door!
Notes: The source images are 1024 x 768, so be sure to preserve the 4 x 3 aspect ratio when generating the mosaic. Give an error when the mosaics contains source images of a different aspect ratio.
Example: Here is the photomosaic I generated with a program I wrote in a couple of hours using the data set you all provided. The magnified portion shown to the right is one of my eyes. Can you see it when you squint?
Extra credit: For those of you who breezed through this homework assignment, there are a couple of extra credit options. Implement any you want for bonus points! Be sure to document any extra credit you do in a write-up so that the TA can understand what you did.
To submit: Just zip up your code and an .exe version and call it MosaicMaker.zip. Also include your final mosaic submission!
Submission Instructions
You are to write your code for these three problems in C or C++ using the Visual Studio environment available on the PCs in the computer lab ECE 211 (or on your own machine, as long as it runs on the machines in ECE 211). The TA will compile your project and run your code and if the code does not compile in Visual Studio you risk getting a 0. You may not use Matlab for the final submission for this project, but you may use it to prototype things if you think it’s faster. Matlab is wonderful for quick prototyping, but I ask you to submit your final code in C or C++ because you should be able to write “shipping” code in this class, not just prototype code. Zip up the source code for the projects as instructed and email them to me before the deadline at 11:59pm on Sunday September 28. This is a hard deadline. Read the syllabus regarding late submissions.
Tips and advice
Get started soon – don’t wait until the last minute. Also be sure to ask me (and the TA) questions if you have them! If you don’t get everything fully working, please write up some documentation that explains what you have done and what works and what doesn’t to help the TA understand your code. This will save us a lot of time and ensure you get a fair grade. Keep an eye on the website for any corrections announcements regarding this homework. Good luck!