Question: In java Write a program that takes the name of a grayscale image file as a command line argument and uses StdDraw to plot a
In java Write a program that takes the name of a grayscale image file as a command line argument and uses StdDraw to plot a histogram of the frequency of occurance of each of the 256 grayscale intensities. Show me how to complete the TODO i set up. Here is a link to draw https://introcs.cs.princeton.edu/java/stdlib/ And I also posted Luminance.java that converts to grayscale. Please make sure your answer is apart of my code directly.


13 14 import java.awt.Color; 15 16 public class Luminance { I return the monochrome luminance of given color @Deprecated public static double lum(Color color) 20 21 return intensity (color) 23 I return the monochrome luminance of given color public static double intensity (Color color) 25 27 28 29 int r color. get Red(); int g = color. getGreen(); int b color. get Blue(); return 0.299*r 0.587 g.114 b; 31 Ireturn a gray version of this Color public static Color toGray (Color color) f 32 int y (int) (Math, round (1um(color ))); Color gray new Color(y, y, y); return gray 34 // round to nearest int 35 37 /I are the two colors compatible? public static boolean areCompatible(Color a, Color b) f 39 40 return Math.abs(intensity (a) - intensity(b))128.0; /Itest client public static void main(String[] args) int [ ] a = new int [6]; for (int i 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
