HDR in AS3

HDRTwo days ago I read about HDR pictures and I was falling in love with them directly. So I would like to show here some stuff since I think the implementation is done but I do not read any HDR file formats (which should not be any problem at all). Currently I am able to mix 2 to 3 photographs together and get a rendered result out of it. The problem is, that I do not find any sample images on the web (that are not a specific HDR format) without getting into copyright troubles.

Since I am also not sure about the whole technique I want to explain here what it does. Maybe I am totally wrong. So think of the fact that theese are my first steps with HDR. First of all I apply a tone mapping filter to all of the images.

First of all the world luminance is calculated using \small lum = \exp(\frac{\sum_{x,y}{log(1+Y(x,y))}}{width \cdot height}) where Y is returning the luminance value (using RGB to XYZ matrix). After this step I walk through every pixel and change the luminance to a scaled luminance using a \small scale = \frac{18}{lum}. The resulting luminance is normalized like this \small newLum(x,y) = \frac{Y(x,y) \cdot scale}{1+Y(x,y) \cdot scale}. After this step I assign the new luminance by multiplying each channel value with it.

After this there is the last and tricky step where I blend all the images together. I think that this is still wrong since I take the darkest as a 100% base and blend the other pictures with 50% opacity onto it.

The results are looking good, if I take three pictures with very dark, middle and high tones but I am not sure that the described technique is correct. Once I get the reader for an RGBE format I will post it here. But I am also a little bit busy.

Check out the HDR group on flickr.com. You will find the source-code for all this stuff of course in the upcomming release of the ImageProcessing library.

Update: Added missing example. Look at the clouds on the right or details in the foreground for example. Remember that all of this is done automatically and in a very experimental state.

2 Responses to “HDR in AS3”


Leave a Reply