P2Programming Assignment 2: Image ManipulationDue: 9/26 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:
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 If the number is greater than 0, your program should blur the image by performing a convolution with a kernel determined by the number.
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... |