Recent Changes - Search:

CS559-2006 Web

Staff Login

Programming Assignment 2: Image Manipulation

Due: 9/26
TA in Charge: Yu-Chi

Why?

To give you some practice writing code to process images and let you try out some simple image operations.

The image operations we ask for are so simple they shouldn't be a problem - but it will force you to make sure you can write image processing code (since the project is coming up). Also, some of the routines we ask you to write will be useful in the project.

What?

You are to write a program that takes 3 command line arguments:

  • a number (whose meaning will be explained below)
  • the name of an input TGA file
  • the name of an output TGA file

Your program should read the input image (using libtarga), perform the appropriate operation (given by the number).

If the number is 0, your program should desaturate the colors of the image. That is, it should keep the luminance approximately the same, but make the color be more gray (gray means that R=G=B). Here's a sample formula for desaturate (L here means "luminence"), set to reduce the saturation by 30%:

L = (r+g+b)/3
r' = .7 * r + .3 * L
g' = .7 * g + .3 * L
b' = .7 & b + .3 * L

If the number is greater than 0, your program should blur the image by performing a convolution with a kernel determined by the number.

  • 1 = 3x3 BSpline (1/16 [1 2 1; 2 4 2; 1 2 1])
  • 2 = 3x3 Box (1/9 [1 1 1; 1 1 1; 1 1 1])
  • 3 = 5x5 BSpline
  • 4 = 5x5 Box
  • (if you want to handle bigger filters, great, but its optional)

In performing these convolutions, note that both filters are seperable. Your kernels should be zero centered (so the image doesn't shift), and you should handle the edge values by renormalizing the kernel.

How will this be evaluated?

We do care that your program is turned in correctly (including proper documentation and readme). You will lose points for not following the rules.

As with other programming assignments, this will be graded on a 0-4 scale. Roughly...
* 1 point for signs of life (read and write images)
* 1 point for getting desaturation to work
* 1 point for getting convolution to work
* 1 point for getting the details of convolution correct (zero centering, edges)

History - Print - Recent Changes - Search
Page last modified on September 11, 2006, at 10:48 AM