COS 426:
Computer Graphics
Spring 2014


General | Syllabus | Assignments | Final Project


Overview

In this assignment you will create a simple image processing program. The operations that you implement will mostly be filters that take an input image, process the image, and produce an output image.


Running the Program

The image processing program, imgpro, runs on the command line. It reads an image from a file (the first program argument) and writes an image to a file (the second program argument). In between, it processes the image using the filters specified by subsequent command line arguments. For example, to add 50% random noise to an image in.jpg and save the result in the image out.jpg, you would type the following command (the noise filter has already been implemented, so you can test this command right away):

% imgpro in.jpg out.jpg -noise 0.5
For each available image filter there may be one or more optional parameters (e.g., noise takes a magnitude). To see the complete list of filters and their parameters, type:
% imgpro -help
If you specify more than one filter on the command line, they are applied in the order that they are found. For example,
% imgpro in.jpg out.jpg -contrast 1.2 -scale 0.5 0.5
would first increase the contrast of the input image by 20%, and then scale down the resolution of the result by 50% in both x and y directions. Of course, you are welcome to create your own filters and add program arguments for them by editing imgpro.cpp. However, please do not change the program arguments for the filters already provided.


Implementing the Image Processing Filters

The assignment is worth 20 points. The following is a list of features that you may implement (listed roughly from easiest to hardest). The number in front of the feature corresponds to how many points the feature is worth. The features in bold face are required. The other ones are optional. Refer to the examples web page for more details on the implementation of each filter and example output images.

By implementing all the required bold features, you get 13 points. There are many ways to get more points:

To get full credit for any of the operations requiring resampling (scale, rotate, fun, morph), you must support three different sampling methods (point, linear, and Gaussian) and compare the results for at least one example. The sampling method to be used by imgpro is controlled by arguments specified before the resampling operation on the command line. For example, imgpro in.jpg out.jpg -point_sampling -rotate 1 -gaussian_sampling rotate 3 will rotate the input image by 1 radian using point sampling and then rotate the result by 3 radians using Gaussian sampling. For Gaussian sampling, choose sensible Gaussian filter dimensions. For scaling, this requires adapting the extent of the Gaussian, for rotation and fun, you may use a fixed size of your choosing.

It is possible to get more than 20 points for this assignment. Your final score will be calculated by adding your score on the required features (up to 13 points) and your bonus for winning the art contest (up to 2 points) to your score on the non-required features, where the value of non-required features incurs diminishing returns after the first 7 points: each successive point beyond 7 is worth 2/3 as much as the previous one. For example, if you get 12 of the 13 points for required features listed in bold and correctly implement optional features worth 10 more points, then your score is 20.4 (12 + 7 + 2/3 + (2/3)^2 + (2/3)^3).



Getting Started

You should download the skeleton code from (cos426_assignment1.zip) as a starting point for the assignment. The zip file contains the correct directory structure for submissions, helpful source code, and a template writeup html file (see cos426_assignment1/README.txt in the zip file for details). To implement the image processing features listed above, you should add code to the appropriate functions within src/R2Image.cpp, add commands to the Makefile to test them, and add sections to the writeup.html to present and discuss your results.


Submitting

You should submit your solution using one zip file named cos426_assignment1.zip via CS dropbox at this submission link. The submitted zip file should have following internal directory structure:

cos426_assignment1/

The writeup.html file should be an HTML document demonstrating the effects of the features you have implemented and would like scored. For some features (e.g., black & white), you can simply show the input and output of your program. However, for features that take an input parameter (e.g., blur), you should provide a series of images showing at least three settings of the input parameter to demonstrate that your code is working properly. You can start from the writeup.html provided with the distribution as a template -- simply add sections to that HTML file for the features you implement in the following format:

The src directory should have all code required to compile and link your program (including the files provided with the assignment), along with a Visual Studio Solution file and a Makefile to rebuild the code. We will not attempt to grade assignments that neither build in Visual Studio nor with GNU Make under Mac OS X.

The Makefile should be a script containing the commands that generate all the images in the output directory that demonstrate features of your program you would like scored. It should run without crashing when started in the cos426_assignment1/ directory (i.e., it should be possible to delete all the files in the output directory and then run make to regenerate them).

We will test your code on Linux by running make in your src/ subdirectory, followed by make in the main assignment directory to create the output images. Please ensure that your code builds/runs in this way before submitting. Your Makefile should generate all the images in the output directory referenced by your writeup.

To save space, please submit images in .jpeg format (not .bmp or .ppm) and remove binaries and backup files from the src directory before submitting -- i.e., run make clean (under Linux or Mac OS) and execute "Clean Solution" on the "Build menu" in MS Visual Studio.

Note that you are expected to use good programming style at all times, including meaningful variable names, a comment or three describing what the code is doing, etc. Partial credit may not be assigned for code without comments.



Hints

A few hints:


FAQ

Answers to frequently asked questions: