We use Nikon D70 to capture the images. Nikon D70 is a high-end professional camera which all intrinsic parameters are controllable. Also Nikon provides a remote control program Nikon Capture 4.0 [Nikon]. The original captured image is at least 1504x1000. In most of our experiments, the images are scaled down to 640x492 using Batch Thumbs.
Film response recovery
Although we can easily dump the raw data from D70, we think it simplify the problem too much. In this project we reconstruct the film response using the algorithm proposed in [Debevec97]. The formulated least-square problem is solved by SVD. We implemented the SVD solver given in Numerical Recipes in C [Press]. The pseudo code from the paper is
There are few things worth mentioning in our implementation. First, the original weighting function suppress the contribution of maximal and minimal pixel values to zero, which results in the rank-deficient problem to SVD. In recovering the radiance map, this weighting function also reduces the dynamic range (No radiance will equal to max or min). We find that these problems can be solved by adding a little base to the weighting function. In our implementation, base is set to 1.
The original method selects the samples manually. We find this manual step can be removed by increasing the samples. In our implementation, 2 times of the minimal required samples are randomly selected, and the result is pretty good. The response curve of our camera is shown below (Drawing using Matlab)
Radiance map construction
The radiance map is generated using equation 6 in [Debevec97]. Although we didn't enforce a very smooth curve in our response recovery step, we did not observe any defect in our result. It is because the radiance map is reconstructed from many input images, and thus noise is suppressed. The final image is output in .hdr file format. One radiance map of the captured scene drawn by Matlab is shown below. The dynamic range is about 800. (I blame the bad weather)
Our program uses bilateral-filtering algorithm mentioned in [Durand02]. However, the contrast reduction method they applied over emphasizes the low radiance part of image and make image more monotonous. As a result, we apply the contrast reduction method mentioned in [Reinhard02] to the filtered base layer.
We divide the R, G and B channels by intensity and re-compose the colors after compressing the intensity.
The images above are the base and detail layer of our test image. There are two parameters for bilateral filtering: the variance of Gaussian lowpass filter (sigma_d) and the variance of edge preserve factor (sigma_r). If sigma_d is large enough (about 0.01*max(width, height)), it is not distinguishable for increasing this parameter.
We use sigma r = 0.4 as mentioned in [Durand02]. We found there is some kind of trade-off for this parameter. If sigma_r is too large, bilateral filter is just like a general low-pass filter, so the halo effect will occur. However, if sigma_r is too small, the image will be a little ashy, and the detail is not conspicuous enough. The image shown below illustrates the effect of choosing different sigma_r.
We test two different contrast reduction methods proposed in [Durand02] and [Reinhard02] and the results are shown below. As we can see, the combination of bilateral-filtering and Reinhard's tone mapping equation gives more vivid results.
Method in [Durand02] Method in [Reinhard02]
We apply our implementation to both public test images and images we captured. We intentionally show some halo effects by using improper parameters. Click the images to see the full size images (BMP format). Compared with papers by the popular test image church, the result of our implementation preserve most details in the right most window, but it's not as vivid as the one in [Durand02]. However, we can't obtain their result by implementing their algorithm.
From test radiance files
From our radiance files
Click images to download the zipped package. (Including the config file for our program)
[lib01] [lib02 (fullsize)] [EE2] [night] [outdoor]
Source code and executable files
To learn how to use, please check readme.txt
HDR image processor, which includes film recovery. (VC6 project) [here]
Tone mapping plug-in for HDRShop. (Also a self-executable program) (.NET project) [here]
© 2006 Chia-Kai Liang and Chihyuan Chung, NTUEE