(x1,y1,z1)
and (x2,y2,z2)
c1
and c2
.
Color c1 = ColorChooser.pickAColor(); Color c2 = ColorChooser.pickAColor();
In a Lab15
class add the two lines above and then
write a Java expression that calculates and then prints the distance between
the colors c1
and c2
. You'll need to use the
Math.sqrt(x)
function to compute the square root.
Also helpful is the function Math.pow(x,y)
which computes x to the y power.
For example Math.pow(3,7)
computes three to the seventh power. You will also need to include the line import
java.awt.Color;
at the top.
yippee.jpg
to gray. Write a Picture
method
blueToGray
to do this. This method should take as parameters the
starting and ending coordinates of the region we want to convert
(just like the redeye
method did).
The way this method should work is that when you see a blue pixel use its RGB values to change the pixel gray. You'll need to experiment with what it means to be close to blue.
Write a Picture
method that removes the green background on moose.jpg
.