Intro Graphics Assignment 2
Image Processing
Due: September 15, 2005
Overview
In this assignment you will create a simple image processing program. The operations that you implement will be mostly filters which take an input image, process the image, and produce an output image.
Getting Started
You should use the following skeleton code as a starting point for your assignment. We provide you with several files, but you should only changeimage.cpp.
main.cpp: Parses the command line arguments, and calls the appropriate image functions.image.[cpp/h]: Image processing.pixel.[cpp/h]: Pixel processing.You can find starter images here, or use Google Image Search. This image is also a good choice.
How the Program Works
The user interface for this assignment was kept to the simplest possible, so you can concentrate on the image processing issues. The program runs on the command line. it performs operations in the order that they appear in the arguments. For example, to increase the brightness of the image
in.bmpby 10%, and save the result in the imageout.bmp, you would type:% image -input in.bmp -brightness 1.1 -output out.bmpNotie that the
inputparameter must appear first. Remember, everything happens in the order specified. First input the image, then change the brightness, then write it back out.For many image filters, there are one or more corresponding arguments. To see the complete list of options, type:
If you specify more than one option, the options are processed in the order that they are found. For example,% image -help% image -input in.bmp -contrast 0.8 -scale 0.5 0.5 -output out.bmpwould first decrease the contrast of the input image by 20%, and then scale down the result by 50% in both x and y directions. It is also possible to specify
-outputmultiple times, to save out intermediate results:% image -input in.bmp -blur 5 -output blurred.bmp -edgeDetect -output edges.bmp -rotate 30 -output whatever.bmp
What You Have To Do
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.For any feature that involves resampling (e.g., scale, rotate, fun), you have to provide three sampling methods: point sampling, bilinear sampling, and Gaussian sampling.
- (1) Brighten: This filter is done for you and you can use it as a starting point.
- (3) Random noise: Add noise to an image.
- (3) Crop: Extract a subimage specified by two corners.
- (3) Extract Channel: Leave specified channel intact and set all others to zero.
- (3) Contrast: Change the contrast of an image. See Graphica Obscura.
- (3) Saturation: Change the saturation of an image. See Graphica Obscura.
- (4) Sharpen: Sharpen an image by extrapolating from a blurred version. See Graphica Obscura.
- (5) Quantize: Change the number of bits per channel of an image, using simple rounding.
- (5) Random dither: Convert an image to a given number of bits per channel, using a random threshold.
- (10) Blur: Blur an image by convolving it with a Gaussian low-pass filter.
- (10) Edge detect: Detect edges in an image by convolving it with an edge detection kernel.
- (10) Ordered dither: Convert an image to a given number of bits per channel, using a 4x4 ordered dithering matrix.
- (10) Floyd-Steinberg dither: Convert an image to a given number of bits per channel, using dithering with error diffusion.
- (10) Scale: Scale an image up or down by a real valued factor.
- (10) Rotate: Rotate an image by a given angle.
- (10) Fun: Warp an image using a non-linear mapping of your choice (examples are fisheye, sine, bulge, swirl).
- (up to 10) Nonphotorealism: Implement any non-trivial painterly filter. For inspiration, take a look at the effects available in programs like
xv, PhotoShop, and Image Composer (e.g., impressionist, charcoal, stained glass, etc.). The points awarded for this feature will depend on the creativity and difficulty of the filter. At most one such filter will receive points.
Submission
You should create a web page with:
- your modified image.cpp file
- at least one result image for each filter you implement, along with the command-line arguments used to make the image
- a writeup.
- a submission for the art contest (optional, but this is probably the easiest assignment for this...)
Hints
- Do the simplest filters first!
- There are functions to manipulate pixel components and pixels in
pixel.[cpp/h]. You may find them helpful while writing your filters.- The brighten filter is implemented for you. This should get you started and show you how to access and modify pixels in an image.