Question: java Instructions You are going to write a brightSpotl method that determines the brightest spot in a picture based on the red, green and blue



Instructions You are going to write a brightSpotl" method that determines the brightest spot in a picture based on the red, green and blue colour arrays. It will take in 3 x by y arrays, which we wil call red, green and blue and return the integer values and j such that the image is the brightest. Remember that for an array arr, you can find its length and width by using the following: arr.length arr[@]. length We will determine brightness as the point (U) in the x by y image where the sum of red 111. greenlillil and bluefilt) is the greatest, The body calls the the method brightSpotl" and based on the input, prints out the foilowing - The brightest spot in the image is at position (ur You will be creating a new method called brightSpotti'. The main method has been taken care of for you. Details of your new method are below. Details Input The brightSpotl method will take the following parameters: - three x by y integer arrays, which we will call red, green and blue to represent the red, green and blue present in the image. Processing Based on the definition of brightness given above, the method will determine the brightest spot (4) in the image. Output The brightSpott/" method will return an integer array containing the brightest spot (U). Sample input/output: Sample 'brightSpot() method input red = {{1, 1}, {1, 1} } green = { {2, 2}, {2, 2} } blue = {{0, 3}, {1,1} } Sample 'brightSpot() method return {0,1} Sample .main() method output The brightest spot in the image is at position (0,1) import java.util.*; public class POD { // PLEASE START YOUR METHOD HERE //PLEASE END YOUR METHOD HERE public static void main( String [] args) { Scanner in = new Scanner( System.in); int height, width; //Get picture height & width height = in.nextInt(); width = in.nextInt(); //Set up image pixel arrays int[][] red = new int[height] [width]; int[] [] green = new int [height] [width]; int[] [] blue = new int[height][width]; //Read in red values for (int i=0; i height; i++) { for (int j ; j width; j+) { red[i][j] = in.nextInt(); } } /Read in blue values for (int i=0; i height; i++) { for (int j 0; j width; j) { green[i][j] = in.nextInt(); } } //Read in green values for (int i ; i height; 1) { for (int j=0; j width; j--) { blue[i][j] -in.nextInt(); } } inte brightest brightSpot(red, blue, green): System.out.println("The brightest spot in the image is at position ("brightest [0]=","brightest[1] ""); in.close(); System.out.print("END OF OUTPUT"); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
