This is a short section to look at type of puzzle built out of image manipulation code.
Code To Fix the Pixels
There is an image of some unknown object
The red/green/blue values have been distorted, hiding the real image
Write code to fix the red/green/blue vlaues
Recover the original image to solve the puzzle
Here we have the "gold" puzzle image -- fix it to see the real image
Gold puzzle parameters:
The green and blue values are all just random values in the range 0..255 ("snow" or "speckle noise")
The data of the real image is exclusively in the red values
In addition, the red values have all been divided by 10 (made dark)
The green/blue snow is obscuring the real image
Write code to recover the real image
// Strategy: zero out blue and green as they
// are just garbage noise data.
// Then scale red up by 10x to see the real
// image in red.
// your code here
pixel.setRed(pixel.getRed() * 10);
In this case, our solution shows the image, but it's all in red. What we have here is basically a black-and-white image, but it is shown in the black-red range, rather than the usual black-white. For this section, we'll say that's good enough. We'll see how to fix the red image so it looks like a proper black-and-white image in a later section.