Question: Convert to Grayscale public void grayscaleWithLuminance ( ) Pixel [ ] pixelArray = this getPixels ( ) ; Pixel pixel = null; int luminance 0

Convert to Grayscale
public void grayscaleWithLuminance()
Pixel[] pixelArray = this getPixels();
Pixel pixel = null;
int luminance 0;
double redValue 0;
double greenValue =0;
double blueValue =0;
for (int i=0; i < pixelArray.length; i++)
pixel = pixelArray[i];
// compute the intensity of the pixel (average value)
luminance =(int)((redValue + greenValue + blueValue)/3); pixel.setColor(new Color(luminance.luminance.luminance));
}
}
explain the code kinfldly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!