Tuesday, 22 July 2008

Playing with HDRI

High Dynamic Range Images (HDRI - Wikipedia article) became very popular recently, and I also experimented with this technique. I don't personally like unrealistic pictures you can often see in the Internet, if you search for "HDR" or "HDRI", so I usually try to preserve natural look.

To make a HDR image one has to make at least two shots of the same scene with different exposure. Many cameras have "auto-bracketing" mode, what makes this part of work quite simple. My camera (Panasonic Lumix DMC-FZ5 - DPreview) can take three shots with maximum -1EV and +1EV exposure range from the base settings. Below is the cuts from three original photos I made with such auto-bracketing. The scene is Anchor Bay at Tawharanui Regional Park, some 80 km north from Auckland, New Zealand.



ISO: 80
Shutter speed: 1/500, 1/250, 1/125
Aperture: f/4.0
Focal length: 6.0 mm (36 mm for 35 mm film)
Metering mode: Matrix
Tripod and polarizing filter.

Polarizing filter reduced reflections from water surfaces and brightness of the sky.

I cut off a small piece from original photos, which includes both very bright (clouds) and darkest parts (black rocks) of the scene. The source files were in JPEG format, as this is the only format my camera allows for auto-bracketing mode.

I loaded all three files into Qtpfsgui (http://qtpfsgui.sourceforge.net/) and created a HDR image using default program settings. Saved the result as Tawharanui.hdr and clicked Tonemap the HDR. This is the most creative and time-consuming part of work with Qtpfsgui, and the goal is to get TWO tone-mapped LDR (8 bits per channel) images: one is as good as possible and another is produced by the Fattal algorithm to improve the first (thanks to Angela Lobefaro for her post to this blog). Qtpfsgui provides 8 different algorithms for tone-mapping; I found Drago, Durand and both Reinhard are mostly suitable for first, realistic looking image, while Fattal or Mantiuk are better for "impressionist" image, aimed to pop-up first one.

In this particular case the first image was made by Reinhard'05 with the following parameters:
pregamma: 1
brightness: -10
chromatic adaptation: 1.26
light adaptation: 0.5



The second image was by Fattal with:
pregamma: 1
alpha: 0.1
beta: 0.8
saturation:1
noise reduction: 0.04
These parameters are actually default ones, except noise reduction; this was carefully adjusted to keep as many details as possible.



Obviously, both images must have the same size and should be saved on the hard drive.

Then I launched GIMP (GNU Image Manipulation Program - http://www.gimp.org/) and opened both of the images here. First steps are simple: make the "Fattal" image active, Select All (Ctrl+A) and Copy (Ctrl+C). Then switch to another image and Paste (Ctrl+V); then go to Layer -> New Layer (Shift+Ctrl+N). Now go to Channels, Paths, Undo, Layers dialog and click on layers tab (Ctrl+L). You will see two layers; Pasted Layer which holds "Fattal" image, is active and actually hides another layer (Background with "Reinhard" image) beneath. Change its Mode to Overlay and shift Opacity down to 70...30 until you think your picture is good enough. That's all.

This is not the best way, because depending on your pictures you can get better results, playing with these settings - try other layer modes like Hard Light, Soft Light, Darken or Lighten Only, Burn or Value with different Opacity settings. You can also adjust your images before blending layers.

For my picture I performed the following actions:
1. Made Background layer invisible (clicked on the eye icon on the Layers dialog)
2. Went to Colors -> Levels and moved the central slider to 0.75; this made my "impressionist" layer darker and "richer"
3. Turned back on visibility of the Background layer, still keeping Pasted Layer as selected (active)
4. Changed layer mode to Value and adjusted opacity to about 0.50
5. Cropped
6. Saved As...

No comments: