HDR to LDR tone mapping Lab exercise 4 in Image Based Rendering 2007 Stefan Gustavson, Jonas Unger ITN-LiTH Unlike the previous lab exercises, this subject has solid, detailed and well presented support in the textbook. The theory you need to complete this exercise can be found in the book, mainly in chapters 6, 7 and 9. 1. Find or acquire an HDR image with a large dynamic range, preferably one where some large light sources are in direct view, or an indoor scene with a view out the window towards a bright outdoor scene. Suitable example images are on the CD which comes with the book, and some may be found on the WWW, e.g. at http://www.debevec.org. 2. Display that image using Matlab with various simple methods for global tone mapping: • View it in linear mapping: values are linearly scaled so that the max value in the image maps to 1.0 in the output. • Perform clipped linear mapping: pick different values to map to 0 and 1, and scale intermediate values linearly. • Use logarithmic mapping: use the logarithm of the value and do a clipped linear mapping on the result. • Add a simple gamma correction before display: map the intensity values through a power function with an exponent of your choice and see if the result gets any better. n n n • Implement the S-shaped curve from the book: Q = I ⁄ ( I + σ ) . First plot the curve itself and see the influence of the two parameters n and σ . (Note that most plots in the literature use a logarithmic scaling for the intensity axis to better visualise a large dynamic range.) Then use the curve to map HDR values to LDR output using different parameters. Add a gamma correction at the end for better presentation on your particular display. 3. Implement a simple “glare” or “blooming” algorithm, by adding a downscaled version of a blurred version of the image to the original imge. Adjust the amount of blur and the scaling to achieve a visually noticeable effect while still having a reasonably good looking image. Large amounts of blurring may be done with repeated convolution with a small, simple filter kernel instead of one huge kernel. A Gaussian blur is also separable, which means you can perform the blur with two linear filter kernels, one vertical and one horizontal, applied in any order. 4. Implement some reasonably complicated local tone mapping operator. Our recommendation is to use the Rahman Retinex model. It strikes a reasonable balance between complexity and quality, it has few parameters ( f and k ) and it is quite straightforward to implement in Matlab. You do not have to include a photometric calibration of the display, an ad hoc gamma correction is OK. We’ll save the photometry for the projects, for those of you who wish to delve further into tone mapping issues. 5. Write a brief report on your results, present a couple of example images and include all your Matlab code. The report can be very informal and brief (a single page of text is enough, plus the code), but make sure you describe what you did with references to the literature, and present your results properly. Hand in the report, on paper, to Jonas Unger, no later than Feb 16. If you should need more time to finish it, tell him. The assignment and the reports may be done individually or in groups of two students. If you have a good reason to be three persons in a lab group, please talk to us first. Good luck, and have fun!