# Tone Mapping HDR Images

Due date: Tuesday, 27 August 2019
Late submission until Tuesday, 10 September 2019

## Overview

Real-world scenes often have a very large dynamic range (the ratio of brightest to darkest intensities) which can span several orders of magnitude. Such high dynamic range (HDR) images cannot be reproduced directly on conventional displays. For example, if all the intensities of the Memorial Church image are linearly rescaled so the brightest pixels are mapped to the highest displayable intensity, the rest of the image becomes extremely dark; if they are rescaled by larger values, details in darker regions become visible, but those in brighter regions are lost.

For a more naturalistic appearance, the range of intensities has to be compressed to the low dynamic range of the display, while approximately maintaining the appearance of the image. This process is known as tone mapping or dynamic range compression.

## Requirements

Linear and logarithmic rescaling

Obtain some HDR test images from Paul Debevec’s HDR page under “Radiance Maps”. Load an HDR image into your program (OpenCV: imread, Matlab: hdrread) and visualize it by linearly rescaling the pixel values. Experiment with different scalings to see the results; include one in which all the intensities fit in the displayable range.

Note that the HDR image contains linear intensity values, while low dynamic range images are quantized nonlinearly, so you will have to apply a gamma correction of approximately $$1/2.2$$ to get a reasonable image. (Or more accurately, apply the $$\gamma(u)$$ function from here to the RGB components.) Do this when creating every output image in this assignment.

As a baseline tone mapping algorithm, perform rescaling in the log-luminance domain. That is, compute the luminance $$L=0.299R+0.587G+0.114B$$ and take its log, rescale it to decrease the dynamic range, then undo the log to recover luminances, and use the original colour ratios $$R/L, G/L, B/L$$ to reconstruct a colour image. Choose a scaling in the log domain to get an output dynamic range of about 100:1.

Detail enhancement

You should find that details in the image become weaker, because logarithmic rescaling indiscriminately compresses both large-scale intensity variations and local contrast.

To counteract this effect, implement some of the spatial-domain image enhancement techniques covered in class, such as histogram equalization, unsharp masking, etc. Experiment with applying them to the HDR image to boost image details and obtain a more visually appealing result. Any techniques you apply here should be implemented by yourself instead of using built-in functions.

Comment on whether there is a benefit to working in the log-luminance domain, rather than directly on the original RGB intensities.

Tone mapping algorithms

This will be the main work of the assignment. Implement one of the following tone mapping algorithms:

You should use built-in routines to compute the FFT and IFFT. Compare the results of the implemented algorithm with those of your approach in the previous part, and discuss its advantages and disadvantages.

Extra credit

Option 1: Implement two of the above tone mapping algorithms.

Option 2: Implement some additional applications of bilateral filtering (e.g. Chen et al., “Real-time Edge-Aware Image Processing with the Bilateral Grid”) or of gradient-domain image manipulation (e.g. Pérez et al., “Poisson Image Editing”).

## Submission and Evaluation

Along with your code, submit a report describing your work and any implementation choices you made. In the report, include images demonstrating the results of each component of the assignment, including examples showing the effect of different choices of parameters.

Weightage:

• Linear and logarithmic rescaling: 20%
• Detail enhancement: 30%
• Tone mapping algorithms: 50%