buettner.to blog

Menu Close

Tag: Tone Mapping (page 2 of 2)

Sunrise Photos: New Edits

I’ve been trying the Mantiuk ’06 tone mapping operation on some of the photos that I’ve edited in the past to see what additional detail might be revealed.  In both of the photos below, the foreground was very dark and, in my original edits, I wasn’t able to do a satisfactory job of showing the foreground detail.

I first posted this one on August 31st.  Here’s a link to the original edit for comparison purposes.  The original was cropped somewhat, whereas this one is not.  The differences in the foreground detail between this version and the original are not that profound.  I think the color of the bare ground looks better in this one as does the detail in some of the foliage.

This one, below, was first posted on July 20.  Again, here’s a link to the original edit.  Again, the crop is different on the new edit – it’s uncropped.  The original showed the trees and the foreground as a silhouette.  This one shows considerably more detail.  Using the editor, GIMP, I zoomed in an looked at the area near the orange cones.  I could almost read the sign sitting along the fence just right of the cones.

While talking to my Mom about these photos, she thought it’d be interesting to see what the out-of-camera versions looked like with no edits (aside from being scaled for upload to this site).  Here they are:

August 31st original:

July 20th original:

Friday Fitness Hike

Today, Bob, Amy, and I hiked the North Trail.  Bob and I continued on up the Chuparosa Trail when we got half way around the loop.  Once we got to the Pemberton, we hiked up to the 150th street trail before turning back.

Here is a view of Tom’s Thumb through a tangle of Palo Verde trees.  We weren’t that close to the McDowells, but I used the limited zoom capability on my camera and then cropped the result to make it look closer than it really is.

A saguaro:

The McDowells.  Tom’s Thumb, Morrell’s Wall, The Granite Ballroom, Sven Tower I, II, and  III, and Rock Knob are all visible in this photo.

Bob taking a photo of a Saguaro near the Chuparosa Trail:

Another view of the Chuparosa Trail.

I found two other crops of the above scene that I found interesting…

Even closer:

I used a tone mapped layer (using the Mantuik ’06 algorithm) in most of the above edits.  I’m happy with the detail that it provides, particularly in the mountains in the background.  In past edits, I often end up with very dark looking mountains without much detail.


Rock Knob

I got this photo during last Sunday’s bike ride.  Rock Knob is the smaller mountain (hill?) in the foreground.  (It looks more like a huge jumble of boulders in this photo than any kind of defined “knob”.)  Part of it resides in McDowell Mountain Park; the rest of it is in the preserve.  The McDowell mountain range is behind Rock Knob in this picture.

I was looking for a way to explicate the detail in the rocks.  Tone mapping with Fattal does the job really well, but I often find the results jarring to my eyes, even while I admire the degree of detail that the algorithm produces.  Fattal also produces some significant halos.

I ended up tone mapping the image with Mantuik ’06.  I hadn’t spent much time playing around with this algorithm because the defaults in Luminance HDR don’t produce appealing results.  After playing with some of the parameters, however, I started seeing more results that I liked better.  These are the parameter values I used:

  • Contrast Factor: 0.50
  • Saturation Factor: 2.00
  • Detail Factor: 1.00
  • Contrast Equalization: Enabled

Although I had three exposures to work with, I only used one as the histogram was fairly well contained.

One problem that I had with the result of the tone mapping is that the lower right corner was extremely dark.  It was unacceptably dark after level adjustment in Luminance HDR.  I ended up adjusting the levels with GIMP instead using a gradient mask in the lower corner to avoid darkening that portion even more.

I found out that the dark lower corner is a known (and unfixed) bug in the implementation of Mantuik ’02 in Luminance HDR.  There is another implementation in pfstools.  For the image below, I used the following command to do the processing:

pfsin DSC04492.JPG | pfstmo_mantiuk06 -s 1 -e 0.4 | pfsview

I loaded that result into GIMP, loaded the original image, DSC04492.JPG, as the top layer and then set its layer mode to color.  Aside from scaling it, I did no other edits in GIMP.  Without the color transfer the color was kind of blah.  Luminance HDR allows saturation values between 0 and 2; pfstmo_mantuik06 only allows saturation values between 0 and 1, inclusive.  I used 1, but there still wasn’t much saturation.

Here is the above image again, with the saturation bumped up even more.

For comparison purposes, here’s the original file, DSC04492.JPG, scaled to be 1080 pixels high.

The Fountain at Night

The photo below is of the Fountain Hills fountain and environs as it appeared last Sunday just after 8:00pm.

The image below was blended in GIMP using three of the ten exposures that I took using my Sony NEX-7.  One of the problems I had with tone mapping the image using HDR software is that there’s a lot of noise in the immediate foreground.  Tone mapping it with Fattal made that noise even more evident.  Most of the other tone mapping algorithms had difficulty with the dynamic range.

For the GIMP blending, I ended up using RawTherapee on the second lightest exposure to lighten up the foreground just enough so that it’s not completely dark.  (The brightest exposure was shot at a higher ISO and had even more noise.)  If you look very closely, you can see some detail there.  It’s very dark though, but it was that way in real life too.  I had to shine my headlamp up at the saguaro off to the far right to make sure that it was in the frame.  That sequence of ten shots took most of the fifteen minutes that I had to get the various exposures of this scene.  (The fountain only runs for fifteen minutes beginning on the hour.)

Below is another result that I got using Mantiuk ’08 with some additional GIMP edits afterwards.  This image is not as sharp and the town lights are too bright, in my opinion.


Sunrise from the Balcony

I’ve been experimenting with RAW files recently.  For the shot below, I used the NEX-7’s exposure bracketing to get three exposures.  Then, using the brightest and darkest exposures, I adjusted the exposure compensation for each so that there were no clipped highlights for the dark exposure and very few clipped shadows for the bright exposure.  There was a 4.5 stop difference between the two exposures  I saved the results and fed those files into Luminance HDR using Fattal to do the tone mapping.  I got an interesting result almost immediately.  While I do wish the sky was a bit more muted, I do like how the foreground details turned out.

I got some reasonable looking results using Ashikhmin too.

And, finally, here is a quick edit where I blended the two layers together in GIMP:


Fountain After Sunset

I wasn’t very happy with the Fattal tone mapping on my HDR Fountain photo.  I experimented with different tone mapping algorithms and parameters to those operations and eventually settled on Durand.  According to Parameters for tone mapping operators, Durand “produces the most realistic pictures. No extreme effects, but very nice output with lots of details in the picture.”  I used the following parameters with Durand:

  • Base Contrast: 4.4
  • Spatial Kernel Sigma: 7.0
  • Range Kernel Sigma: 5.1
  • Result Size: 6000×4000
  • Pre-gamma: 0.52

I didn’t change any of the levels or gamma in Luminance HDR.  Instead, I used GIMP and treated the HDR result as if it were an image that came out of my camera.  I employed the usual techniques of making layers, creating layer masks, and setting the layer modes to achieve the effects that I’m after for certain portions of the image.

Here’s the result:

Fountain after Sunset, tonemapped using Fattal

The parameters for the Fattal tone mapping in the photo below are as follows:

  • Result Size: 1536×1024
  • Pre-gamma: 1.00
  • Alpha: 0.10
  • Beta: 0.94
  • Color Saturation: 0.90
  • Noise Reduction: 0.00
I didn’t change either gamma or the levels after the tone mapping operation.  Instead, I edited the image with GIMP, duplicated the layer and set the layer mode to multiply.  This worked fairly well, but for the upper half of the image ending up darker than I would have liked.  So I created a graduated selection which ran from mostly invisible at the top to fully opaque about a third of the way from the bottom.  I set this as the layer mask on the “multiply” layer.  The image looked much better.
There was a large halo around the big saguaro in the foreground just along and slightly above the horizon.  I found the exposure from the original seven used to create the HDR image, scaled it to the correct size and then copied it over as a new layer.  I created a layer mask with the halo area and then adjusted the transparency until it looked right.  The color wasn’t quite right along the horizon (and still isn’t, but it’s better), so I used curves to increase the amount of red in that area and decrease the amount of green.
I discovered that, when using Fattal, choosing the result size makes a big difference.  I had been choosing a result size of 6000×4000 which was the size of the exposures that came out of the camera.  But doing this resulted in an image that looked over-sharpened when viewed at a scaled resolution.  I tried for a long time, but failed to come up with a set of parameters which looked really good with that large result size scaled down to something smaller.  If you view the 6000×4000 result unscaled, it looks pretty good.
The image below will look best if viewed at its native resolution of 1536×1024.  It will probably not look too good if the device upon which you’re viewing it scales it to some other size.

FH lights at night

Below is another HDR photo, though I’m not entirely happy with it.  It was taken from part way down Golden Eagle Blvd at a place that overlooks a good portion of the town.

I spent a long time playing with various tone mapping operators, but in the end chose Mantuik ’08 again, this time with a Color Saturation of 1.00, Contrast Enhancement of 1.51, Pre-Gamma of 1.3, and (post) Gamma of about 0.5.  (I forgot to record the precise value of the final brightness adjustment.)  In GIMP, I despeckled the road, ran unsharp mask on the entire image with a radius of 5, amount of 1.00, and threshold of 0.  I decreased the brightness of the sky using Curves and adjusted the contrast of the highway too using Curves.  I thought it would be cool to darken the road surface, but enhance the colors of the stripes.  (I’m recording what I’ve done here more for my benefit than anyone elses.)

While playing around with the various tone mapping parameters, I found that sometimes small changes in one parameter can lead to large changes in the resulting image.  I was able to get some reasonable looking results from Fattal, but it did not show much glow in the sky.  It looked just weird with a dearth of stars for no apparent reason.  The other thing about Fattal is that histogram usually has one big bump in it.  I find it difficult to do any further editing using Curves on such images.

Most of the tone mapping results contained  bright speckles on the road and other areas in the immediate foreground.  These are not evident or at least not obvious in the original exposures and I’m at a loss to explain them.  I was able to remove them by running GIMP’s despeckle filter with the Recursive box checked.  If I don’t allow it to run recursively, it removed some speckles, but seemed to add new ones for some reason.  I had to constrain the region in which I used the despeckle filter too as I found that it removed some of the lights and stars when running it on the entire image.

The glow in the sky is not due to a sunset, but rather the lights of Scottsdale.  The bright red house in the foreground really was that color, but only for one exposure.  I’m not sure why it’s a bright red in just that one exposure.  In the subsequent exposure, the house is no longer red, but it looks like the garage door has opened and green light is spilling out.  In all later exposures, the house is dark.

I’m note sure what HDR got me in this instance as I think I might’ve been able to obtain similar results by just using the brightest exposure.  I did some tone mapping operations where the lights were considerably more muted, but I ended up not using any of those results.

Crested Saguaro, Revisited

Several days ago, I took some photos of the crested saguaro near the parking area for the Dixie Mine Trail Head.  While I liked the night shot of the saguaro, I felt that I could do better.

So, last night, I decided to give real HDR photography a try.  I went out well after sundown and brought a tripod with me.  For the photo below, I used eight different exposures each taken one stop apart.  I turned off image stabilization, locked the focus, and shot at f/3.5 in manual mode.  The longest and brightest exposure was thirty seconds long.  I wanted to go even longer so that I could use a lower ISO than 400, but that’s the longest (non-bulb) setting that my NEX-7 has.  Each subsequent (and darker) exposure had the shutter open half as long as the previous exposure.  My NEX-7 does not have an auto-bracketing mode that can be triggered with a remote, so I manually adjusted the shutter speed between each exposure.  This is, of course, less than ideal because touching the camera in between exposures could cause it to move slightly.

I processed those eight exposures with Luminance HDR and used the Mantiuk ’08 tone mapping operation with color saturation set to 1.26 and contrast enhancement set to 1.11.  I’m not going to pretend that I know what these parameters mean or even if they were optimal for my photo(s), but I’m recording them here so I’ll know what they were if I want to try something like this again.

I had a problem with the stars in the resulting image.  The Earth’s position with respect to the stars changes moment to moment due to the rotation of the Earth.  This was evident after merging the eight images together.  For each star, there was a sequence of stars each offset from one another by a small but noticeable amount.  So, using GIMP, I edited back in the stars from the brightest of the eight images.  I think I could have tried to mask the sky for all but one of the exposures using Luminance HDR, but I’m better at using GIMP.

Here is a 1:1 crop of an interesting portion of the scene.  In the upper right, you can see a portion of the “crested” arm of the saguaro.

Update on 2012-08-22:

I learned recently that I didn’t check the correct box to cause the HDR software that I’m using to align layers.  In some instances this makes a big difference.  So I reran the Luminance HDR on the same set of exposures as before, this time telling it to use hugin align_image_stack.  It takes quite a while longer to do the processing but, in the case of the fountain photos, it was worth it.  When it finished, I had it use Drago for the tone mapping with the default parameters (Bias = 0.85 and Pre-Gamma = 1).  The output looked atrocious without any adjustment of the levels or gamma when it’s done.  Nevertheless, I wrote the file out as is, choosing to do those adjustments in GIMP.

In GIMP, I found that I got good results by simply duplicating the background and then using the multiply layer mode to combine them.  That result required only minor tweaking via curves.  After that, I replaced the sky with the brightest of the exposures used to form the image and ran curves on the sky, making the necessary adjustments so that I saw lots of stars.  Once that was done, I ran unsharp mask on the entire image with a radius of 8 pixels and an amount of 0.70.

The image below looks very similar to the one above, but it’s a bit sharper in some areas and I think the lighting and colors is better too.

Tone Mapping in GIMP using the GEGL Operator fattal02

GIMP 2.8.0 includes a new – well, new to me anyway – GEGL operator called fattal02.  It’s named after the lead author, Raanan Fattal, of the 2002 SIGGRAPH paper,  Gradient Domain High Dynamic Range Compression.  (The other authors are Dani Lischinski and Michael Werman ) I have not read this paper yet, but I have visited the site at that link and have looked at their Belgium House photos.  Their resulting photo is very impressive.

I also found this page, Parameters for tone mapping operators, which describes a number of tone mapping algorithms – not the details of the their operation – but when they’re useful and the type and quality of their output.  It also describes the parameters that control the operation of the algorithm and provides hints on ranges of values that might produce the most promising results.

Frank Dürr’s page, Comparison of Tone Mapping Algorithms, is a very nice introduction to why tone mapping is necessary and shows the results of some of the tone mapping operators.  (Added 2012-08-22.)

I tried out fattal02 on this scene, which is, yet again, a slightly different crop of a photo that I’ve been using for a number of experiments.  My first inclination was to use the same starting photo that I had been using for my c2g experiments, but I’m running GIMP 2.8 on Fedora 17 running in a virtual machine.  It works, but is by no means very fast.  Anyway, here’s the photo upon which I conducted my experiments:

Below is the result that I got by using Alpha=0.10, Beta=0.90, and Saturation=0.80.  I tried other values for Alpha, Beta, and Saturation that were close to these values, but only saw subtle differences in the output – sometimes, the differences were so subtle that I couldn’t see a difference.  I also tried a few values that were farther away, but the output was not as good, in my opinion.

I find it interesting that the color near an edge is either lighter or darker, depending on where it is, and then becomes either darker or lighter away from the edge.  The sky, for example, is pretty dark, but it lightens up considerably around the buildings and trees giving them a halo.  The walls of the building, on the other hand, are lighter in color, except near the edges where they generally darken.

I tried playing with this scene using the Curves tool after running fattal02, but I couldn’t do much with the whole scene.  The point of tone mapping, in some instances anyway, is to decrease the dynamic range of the image so that details can be seen on displays which also have a limited dynamic range.  This is definitely what happened here.  This is the histogram shown by the Curves tool:

I also tried selecting the sky by color, but this proved very difficult to do, in the fattal layer anyway, due to the fact that the color of the sky ended up being somewhat close to other colors in the scene.  However, it’s relatively easy to select by color in the original scene.  When I do that and play with the curves for one of the fattal02 layers, I can lighten the sky up like so:

There are two other tone mapping operations provided by GEGL, mantuik06, and reinhard05, but my early attempts at using them produced no useful results.  But, to be fair, I had not yet found the page which describes how the parameters should be set.

© 2020 buettner.to blog. All rights reserved.

Theme by Anders Norén.