To help you test your solution, an offline tester is provided which will allow you to test the examples. As usual, to use it you should modify your program to read from standard in and write to standard out. Your program should read the parameters one at a time, each on its own line. You should then write your output array, one element at a time, to standard out, with whitespace delimiting elements (be sure to flush your output at the end).

A sample solution that works this way is provided. You will notice that this is no different from the solution one would submit on the website, except that a main function has been added.

To run the examples offline, you must download and extract the contents of ImageFilter.zip. When running your code, you must specify the seed for the random number generator, the base filename of the image files, and the executable command (using -seed, -base, and -exec). To run things, you must have the files <base>.raw and <base>.result You may then specify one of a number of optional parameters: When rendering your result, it is scaled by taking
floor((intensity - min) / (max - min) * 255.999)
If the correct result was loaded, the min and max values from it are used (over all channels). Otherwise, the min and max values of your image are used. The .raw.png and .result.png files provided are also scaled in this way (using their own mins and maxes). When rending the difference, it is scaled as:
floor(abs(diff)/max*255.999). All the images are rendered using only 8 bits per channel.

For example, after downloading ImageFilter.zip and example 0, you could compile the sample solution by running:
g++ sol.cpp -o3 -o sol
You could then run:
java -Xmx512M Runner -exec ./sol -seed 0 -base 0 -view -output -diff

"-seed 0" tells the program how to generate the filter (the seeds are the same as the example numbers). "-base 0" tells the program to look for 0.raw and 0.result for the input and correct output. "-view" tells the program to display your result on the screen, and "-output" tells it to save "0.you.png".

To generate your own tests, you will first have to extract the color values from an image into a file with the same format as the ".raw" files (width, the height, then RGB values in row major order as integers from 0 to 65535, where the red, green and blue values of each pixel are grouped together -- in the example files each line represents one pixel).

Be aware of whether commas or periods are being used as decimal points. If you want a decimal point, but are in a non-English locale, you can run:
java -Duser.language=en ...