Computer Science 101 Major Project - Component 2 Due Oct 30 at 11:59 pm Complete two new image processing modules: gray.c includes functions: void gray_ppm_image(image_t *input, image_t *output) void gray_ppm_row(image_t *input, image_t *output, int row) void gray_ppm_pixel(image_t *input, image_t *output, int row, column) fade.c includes functions: void fade_ppm_image(image_t *input, image_t *output, double factor) void fade_ppm_row(image_t *input, image_t *output, double factor, int row) void fade_ppm_pixel(image_t *input, image_t *output, double factor, int row, int col) Both of these modules transform only the COLOR of the pixel so input_index == output_index = row * (in or out)->width + col; For the grayscale operation you will need to compute the NTSC "luminance" of the pixel in the input image. The luminance of an input pixel is defined to be 0.30 * red + 0.59 * green + 0.11 * blue where red, green, blue are the (r, g, b) components of the input pixel. The red, green, and blue components of the output pixel should all be set to the luminance value. Since the (r, g, b) components of each output pixel are equal, the output image should appear as varying levels of gray as in a black/white photograph. The objective of the fade operation is to make the image look like a faded color photograph. The fade factor is a double precision value in the range [0.0, 1.0]. A fading factor of 0.0 should produce NO FADE AT ALL. A fading factor of 1.0 produces a gray image. The fading algorithm should first compute the luminance of an input pixel. The value of the output pixel should be: (r,g b (of output)) = factor * (luminance, luminance, luminance) + (1 - factor) * (r, g, b) of input. For example: If the input pixel is (r = 200, g = 80, b = 120) then the luminance is 0.3 * 200 + 0.59 * 80 + 0.11 * 120 = 120.4 Suppose the fade factor is 0.2 Then the output pixel is 0.2 * (120.4, 120.4, 120.4) + 0.8 * (200, 80, 120) = (188, 88, 120) You are responsible for producing your own "main" functions for testing. For the gray operation the previous main will work fine. I don't care how you do it and your main will not be used in testing your code -- So you MAY NOT modify the function prototypes given above. Adhere to the following programming standards. Violations will lead to deductions. (1) no function should be longer than 20 lines code + whitespace. (2) the maximum nesting level in any function is ONE (3) code lines should not extend beyond column 72 (4) no more that one statement may be written on a single line (5) use reasonably descriptive names for variables and functions (6) your program should compile without any warnings with gcc -Wall (7) indenting should be consistent with logical nesting (8) diagnostic / debug prints should be disabled/deleted in your submission. HOW TO SUBMIT YOUR CODE: 1. You should submit 3 files: image.h gray.c fade.c 2. The submission directories lie in the directory /local/jmw2/101/mp2 3. Use the same basic procedure for submission described in mp1.