Question: I am working on a Java project that deals with pixels in any given picture. I have the alogrithms written and actual code written for
I am working on a Java project that deals with pixels in any given picture. I have the alogrithms written and actual code written for the most part but need help. Here is an API document we are to use http://www.cs.rutgers.edu/~atjang/mediacomp/docs .
The pixels are presented to you as an indexable set (like a 2D array). Every pixel has 3 values red, green, and blue associated with it. For example, pure red has the pixel value of (255,0,0). Pure green has the value of (0,255,0) and blue (0,0,255). Implement the following methods exactly as written:
1. Count how many pure red pixels there are in an image.
public static int countRedPixels(Picture v)
2. Change all the pure red pixels in an image to pure blue pixels and vice versa
public static void switchRedBlue(Picture v)
3. Take the left half of an image and reflect it over an imaginary vertical line going across the middle of the image. (If pixels exist ON the midline, leave them there without reflecting).
public static void flipHorizontal(Picture v)
4. Take the top half of an image and reflect it over an imaginary horizontal line going through the image (If pixels exist ON the midline, leave them there without reflecting).
public static void flipVertical(Picture v)
5. Take the upper half of an image and reflect it over an imaginary diagonal line going from the upper left corner of the image to the lower right corner. (Reflect from upper right to lower left diagonal line, assume images are square).(If pixels exist ON the midline, leave them there without reflecting).
public static void flipDiagonal(Picture v)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
