2 write a class called greyscale that implements the

This preview shows page 6 - 7 out of 9 pages.

2. Write a class called Greyscale that implements the Filter interface. For each pixel in the image, add together the red, green, and blue values. Then, calculate the average value per pixel by dividing the total by 3. For example, you might find that the average value is 116.5. Then assign each of the red, green, and blue instance variables for that pixel to the calculated average. You may need to cast the average to (int). Test your filter on an image after it has been demosaiced to be sure that it works as expected. 3. Write a class called ShiftUp that implements the Filter interface to shift the image one row up. You should wrap-around the top-most row to be the bottom-most row. (Be sure to copy values to a temporary array if you need to assign those values later.) The effect should be that the picture scrolls upward when the button is pressed. Test your filter on an image after it has been demosaiced to be sure that it works as expected. 4. Write a class called FillBorder that implements the Filter interface to create a black border on the four edges of the image (top, bottom, left, right). The border should be 10 pixels wide (at the top, sides, and bottom) and overwrite whatever color was previously on the image. Black has values of 0 set to red, green, and blue. Test your filter on an image after it has been demosaiced to be sure that it works as expected. 5. Write a class called Brighten that implements the Filter interface to brighten the image (colors get closer to white, remember white has values of red = 255, green = 255, blue = 255). You may decide how to create this effect in your program (for example, add 5 to each color), but it should work for all possible colors. For example, if one of the colors is 255, then you cannot brighten it anymore. Test your filter on an image after it has been demosaiced to be sure that it works as expected. 6. Write a class called MixUp that implements the Filter interface to rotate the red, green, and blue values for every pixel in the image. For example, if a pixel has red=100, green=200, and blue=50, after rotating, the pixel should have red=50, green=100, and blue=200 (red gets blue’s value, green gets red’s value, and blue gets green’s value). (Hint: you’ll need a temporary variable to do the rotation…think of swap in selection sort.) Test your filter on an image after it has been demosaiced to be sure that it works as expected. After 3 MIxUps, you should get back the original picture.
Image of page 6

Subscribe to view the full document.

7. Write an original image manipulation filter of your choice. To give you ideas: adjust the colors to the full range of 0 to 255, darken an image, make an image sepia tones (brownish), make an image only black and white, shift the image left or right, dither an image, create a watercolor painting, draw the outlines of items in the image (look for large contrasts in adjacent pixels and edge detection algorithms), etc. Test your filter on an image after it has been demosaiced to be sure that it works as expected.
Image of page 7
You've reached the end of this preview.
  • Spring '14
  • AndrewM.Nuxoll

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern