What is HDR Deghosting?


HDR (or HDRI) is short for "high dynamic range image". Images we see on our computer screens range in brightness from 0 to 255, but there are many more intensities of light in the real world. This is why when we take photographs of magnificent scenes, like sunsets, it often turns out dull. High dynamic range images contain a higher range of light. The values HDR images can be processed by tone mapping to be viewed on regular monitors.

To capture an HDR image with a regular camera, one can take several pictures of the same scene, adjusting the shutter speed with each exposure, resulting in a series of pictures from dark to light. An HDR image can be made by combining the well-exposed pixels from the source images. However, there are frequently moving objects (such as people) in the scene, causing each picture to be inconsistent with the rest. This results in ghosting - objects appear semi-transparent. The process of removing the semi-transparency is called deghosting.

Khan Algorithm Results

Most deghosting algorithms use radiance differences to determine the position of objects, then they choose the best exposure of that object, and use that for that part of the picture. The "Khan" algorithm (Ghost Removal in High Dynamic Range Images) operates on a per pixel level instead. It assumes that there are more images that depict the background than those that depict the foreground, and that if a pixel's neighbors are in the background, then the pixel has a high probability of being the background. In each iteration, each pixel is given a weight based on how likely it is to be in the background. At the end, instead of picking the pixel with the most weight, it takes all the inputs and combines them according to the weight. This produces some noise removal effects in addition to deghosting.

I implemented the algorithm as a C++ program, and the results look similar to those on the algorithm's webpage.

These were the source images:






After 1 iteration:


After 5 iterations:


After 12(phew) iterations:









Even though the ghost is pretty much non-existent after 12 iterations, there's still traces of the head (it's darker than the rest of the bridge) if you look really really hard. Also, the small branch movements did not get deghosted very well, expected, because the assumption that most images represent the background and are identical do not hold for these branches.



The branches would need some additional constraints to deal with, but the small leftover of the person could be removed if I just ignored the lowest weight. But, if I just ignore an image, the algorithm would lose it's noise removal qualities. So I decided to distribute the final weights logarithmically (I think) instead of linearly, causing the smaller weights to become even smaller without changing the large weights much. If I do this by a factor of 5 , then the ghost is completely gone, but the "do not enter" sign starts to show signs of noise (it's hard to see because it's jpeg, maybe I should upload another image some time...). If I weigh the final weights by a factor of 2, however, the ghost still remains. Finding the distribution nirvana is on my to-do list, after I get pyramid implementation done (will blog about that soon).


Factor of 5:




Factor of 2:

No comments: