Image-5 Exercises

Here we'll do puzzles like the gold puzzle shown in lecture. Reminder: here is the line to use in the loop to multiply, for example, the red value of each pixel by 20:

pixel.setRed(pixel.getRed() * 20);

1. Iron Puzzle

Write code to fix the puzzle-iron.png image. The green and red values in the image are random speckle noise, so they should be set to 0. The real image is in the blue values, which have been divide by 10. The "solution" image will look blue, since it is exclusively in the blue values, but don't worry about that. We'll see a way to fix that blueness in a later section.

image-5-ex1

2. Copper Puzzle

Write code to fix the puzzle-copper.png image. The red values in the image are random speckle noise. The real image is in the blue and green values, which have been divide by 10.

image-5-ex2

3. Sunny Puzzle

There is an image of someplace famous hidden in the puzzle-sunny.png image. The image is in one color (for you to figure out), but it has been divided by 5. The other two colors are random speckle noise. Write code to reveal the real image: figure out which color contains the image and multiply it by 5. Remove the speckle noise of the other two colors. As with the Iron Puzzle, the resulting image will be all in one color (red or green or blue) which is acceptable at this point.

image-5-ex3

Each click of a Run button saves that code on the computer running the browser. The button below retrieves the all code exercises listed to the right of the button.

count 3 : image-5-ex1 image-5-ex2 image-5-ex3

(code appears here)