top of page

Debevek & Malik Implementation

I began by implementing one of the extremely popular methods of recovering high dynamic range radiance maps proposed by Debevec & Malik in their 1997 paper titled Recovering High Dynamic Range Radiance Maps from Photographs.  Here, I cover some of their basic assumptions and intuition.  For more information or details on the math, refer to their paper.

Basic Assumption and Intuition

The basic assumption that they rest their paper on is that the captured intensity of a scene can be expressed as:​

​

 

 

Where Z is the captured value of a pixel i on image j, E is the true irradiance of the pixel i, and âˆ†t is the exposure time for image j.

We can intuitively understand their method by looking at the following two figures.

​

In the figure on the left, each unique symbol (x, +, o) represents one point captured at five different known exposures.  The unknown log irradiance has been arbitrarily assumed to be zero. Note that the shape of the response curve is correct, though its position on the vertical scale is arbitrary corresponding to the unknown log of the irradiance, Ei. Essentially, the goals of the the optimization process is to slide the 3 sampled curve segments up and down (by adjusting their log Ei’s) until they “line up” into a single smooth, monotonic curve, as shown in the right figure. This will be the recovered camera response curve.

Point Selection

In the paper, they chose their points by hand.  Bearing the above intuition in mind, it follows that the selection points should be at places where they will collectively recover the response curve when sampled across several exposures.

Results and Output

Original Images

The original paper provided access to the set of images taken at a church on which they demonstrated their method.  In this example, the sun is situated behind the rightmost stained glass window.  

Recovered Response Curve

Using their method, I recovered the camera response curve.  

​

On the left are 10 points from 16 different exposures on three channels “lined up” with a fitting curve.  You can see that in some images, certain pixels level out to be saturated, while other pixels are too dark to differentiate from noise.

​

On the right are jus the fitted curves for each color channel.

Tone-mapped results

After recovering the response curve, I used the method proposed by Debevec and Malik to recover the HDR radiance map using the response curve and all of the photographs available.  

 

In order to display any high dynamic range radiance map, it needs to be mapped down into the limited range which a screen can display.  This process is called tone mapping – this is also well studied.

​

For tone mapping, I relied on Matlab’s image processing library, which comes equipped with two tonemapping methods.  The results are shown Here.

tonemap(hdr_img)

localTonemap(hdr_img)

Selecting which is "better" is subjective, though depending on the application, one might be more useful than the other.  I prefer the local tonemap for this example.

Taking HDR Photos Using Mobile Phones

All that's needed for the creation of HDR maps is access to a camera's shutter speed.  All professional cameras have this feature, most basic cameras have it, and now even mobile devices are incorporating this feature into their cameras.  

​

With my Oneplus 5, I have access to "Pro Mode" which includes shutter speeds ranging from 1/8000 s to 30 s.  On the right are screenshots that show these modes.  

Results From My Phone Camera

I captured this set of images by holding my phone up against my bedroom window (steady) and captured these images at different exposures.  Then I ran it through the algorithm.

The image below is the resulting camera response curve and constructed HDR image using automated point selection and general tone mapping.

Extensions

After implementing the method discussed in the paper, I worked on some extensions to it.  Explore them below.  I recommend starting at the first one.  

Automatic Point Selection

Bypassing the need to select points by hand for each set of images.

Image

Registration

For when the images aren't taken with a steady hand or tripod.

Fixing Issues with Saturated Pixels

When images are saturated in all images, it causes some problems.  I attempt to work around this issue.

© 2018 by Samareh Shahmohammadi. 

bottom of page