(submit by 03/05/2005)
Your first assignment is to implement the tone mapping algorithm described by Durand and Dorsey (2002). (Be sure to visit this link, since the page contains some useful remarks regarding the algorithm).
Input: Your program should read HDR images stored in the Radiance HDR format (using the provided hdrio library);
Action: Compress the global contrasts in the image using fast bilateral filtering;
Output: write the result out as an ordinary low dynamic range (8-bit per channel) image. You may use the provided routines for saving TIFF images, or any other image I/O library of your choice.
Arguments: Compression factor (mandatory). Other (optional) arguments: an argument to perform brute-force (slow) bilateral filtering, an argument for specifying the number of different luminance values for which convolutions will be computed, and an argument for specifying a reduced spatial resolution at which to perform the computation.
Suggested plan of action:
Bonuses: will be given for a nice GUI, interesting extensions, fastest implementation.
FFTW: Since the convolutions in the fast bilateral filtering operation require computing the discrete Fourier transform (DFT) of the image and of the Gaussian kernel, you may use the fftw library installed on our Linux machines (and downloadable from www.fftw.org). You'll need to read the documentation, look at the examples, and figure out how to use it on your own. I believe you'll need to use the following function calls (assuming FFTW version 2.1.5):
fftw2d_create_plan
fftwnd_one
fftwnd_destroy_plan
hdrio: a library for reading and writing HDR images in the Radiance format. This is done by using the following two function calls below. You'll need to compile the library and link your program with it. The source may be found under ~danix/public/atcg2005/hdrio/.
/*
* readRadHDR - read a Radiance picture from file named fname.
* width and height are assigned the dimensions of the image.
* Allocates and returns a float array of length 3*width*height
* containing the RGB pixel values in row major order.
*/
extern "C"
float *readRadHDR(char *fname, int *width, int *height);
/*
* writeRadHDR - write a Radiance picture to a file named fname.
* width and height specify the dimensions of the image.
* The RGB pixel values are stored in row major order in the
* float array image (of length 3*width*height).
*/
extern "C"
void writeRadHDR(char *fname, float *image, int width, int height);
TIFF image I/O: Include the tiff_rw.h header in your source file; compile tiff_rw.c and link with your code. These two files may be found under ~danix/public/atcg2005/. To write a TIFF image call the following function:
/*
* Write a TIFF image file named fname. The image has width by height
* pixels (each pixel has three color channels corresponding to r,g,b).
* data stores the pixels in row-major order, with the color channels
* interleaved.
*/
extern "C"
write_tiff(const char *fname, int width, int height, unsigned char *data);
Simple usage example: Under ~danix/public/atcg2005 you'll find a very simple program (main.cpp) and a sample Makefile that demonstrate how to use hdrio, tiff_rw, and how to link with them.