This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature

Tone-mapping HDR photos with Qtpfsgui

By Nathan Willis on May 23, 2007 (8:00:00 AM)

Share    Print    Comments   

A lot of photos tagged with "HDR" turn up on Flickr and similar photo sharing sites these days. They're unnatural, surreal, sometimes crazy-looking images with the bright areas darkened, the dark areas brightened, and lots of saturation. You can get in on the craze under Linux using Qtpfsgui.

HDR stands for high dynamic range, and in reference to this particular look it's a misnomer -- all Flickr photos are standard, low dynamic range JPEGs. Use of the term HDR in this context stems from the fact that the technique generally begins with multiple low dynamic range shots of the same scene taken at different exposures. The shots are stacked together to mimic the effect of an HDR original. The stack of images is then tone-mapped, pulling in shadow detail from the darkest exposure and highlight detail from the brightest. It's that tone-mapping step that gives these images their distinctive appearance.

figure 1
Figure 1: the scene. Click to enlarge.

When the original scene has too much dynamic range to be properly exposed, bracketing and tone-mapping is a straightforward way to save it. Take the window scene in figure 1, for example. It has a serious technical problem: the sunlight outside the window is so much brighter than the room light inside that no exposure will capture both correctly.

To overcome this hurdle, you take one shot exposed for the outside sunlight, and one shot exposed for the interior. You could open both as layers in an image editor like Krita or the GIMP and manually blend them, but Qtpfsgui will combine them into one automatically.

Fire it up

You can download Qtpfsgui from its project page as source code, or follow the links there to third-party binary packages for openSUSE, Fedora, and Ubuntu. The current version is 1.8.5, and requires Qt4, libtiff, libexiv, libjpeg, and libopenexr to function.

After launching Qtpfsgui, click on the New Hdr toolbar button to start a new project. In the first step, you select the images that you wish to combine. The program can load JPEG, TIFF, and RAW files. In step two, you can tweak the settings Qtpfsgui uses to merge the images; the dialog box encourages you to stick with the default configuration. Once it is done, step three loads the resulting combined image for you to preview.

figure 2
Figure 2: the GUI. Click to enlarge.

In the preview window, you can adjust the gamma of the image, or zoom in and out to examine the details. The histogram above the preview shows you the range of brightness captured in the image. At this point, it is a good idea to save your work -- the "Save Hdr as..." menu item will write the merged image to an OpenEXR-formatted file.

Tone-mapping the merged image is where the real action is. Clicking on "Tonemap the Hdr" opens a new window in which you can preview and tweak your choice of tone-mapping algorithms. Qtpfsgui 1.8.5 offers seven: Ashikhmin, Drago, Durand, Fattal, Pattanaik, Reinhard '02, and Reinhard '04. The names of these algorithms come from academic papers in which they were described. Qtpfsgui uses implementations from the pfstools command-line package; to learn more you can consult the pfstools page linking to each paper.

You can also read through the practical comparison on Qtpfsgui's wiki, although the information there is inconsistent from algorithm to algorithm, and much of it is subjective. The only real way to determine which algorithm produces the best results is to try them all. Qtpfsgui lets you generate previews for as many tests as you care to look at, at a number of sizes. On a slower system, it is a good idea to run a few samples at thumbnail size before you try to export any full-resolution output. You can save your output in JPEG, PNG, PBM, or BMP format.

Figure 3 features several tone-mapped samples using different algorithms (all at their default settings). As you can see, they vary considerably in effect and how natural they appear. Even on some of the most natural-looking, though, you can find odd-looking artifacts such as the halo effect around the curtains, and the black highlights on the arm and back of the sofa.

figure 3
Figure 3: the output. Click to enlarge.

It is also worth noting that because of the strong, sunlit backlight, neither exposure captured any detail in the window frame. The tone-mapping operations decided to make it white, which it isn't. Certain picture elements -- strong direct backlight, translucent materials, and thin objects like blinds or branches -- are always going to prove problematic.

Go nuts

I chose a plain example to illustrate tone-mapping's original purpose: to fix otherwise impossible-to-expose scenes. The fancy and surreal tone-mapped stuff that you see on Flickr is often the result of pushing the process way past correction. If that is what you want to do, Qtpfsgui is the easiest way to go on a Linux system.

With seven algorithms to choose from, fine-grained control over each algorithm's parameters, and rapid-fire generation of thumbnails, there is almost no look you can't achieve. The documentation recommends the Fattal algorithm for producing the most outlandish effects -- those that reduce the overall image contrast the most, making the sky and the foreground alike almost flat.

You can even use Qtpfsgui to produce unnatural tone-mapped images from a single frame, although you are better off starting with multiple, bracketed exposures. That is because underexposed shadow areas have a lot of sensor "noise" that is not noticeable when black, but sticks out as ugly, multi-color grain when brightened and saturated.

But if you like experimenting with the weird look, try it even on normal, single-exposure shots. With modern digital camera sensors, it really does take a large difference between highlights and shadow areas to produce a scene that can't be captured with detail in camera RAW format.

Qtpfsgui is not an editor

Qtpfsgui does not provide any mechanism to align the images that it merges; any misalignment will result in ghostly artifacts likely to be exaggerated by tone-mapping. Since Qtpfsgui does not provide any image editing tools, it is best to shoot all input frames on a tripod, and to minimize camera shake with the longer exposures. That way you can import RAW originals directly.

Alternatively, you could edit your RAW originals in a 16-bit-per-channel editor like Krita or CinePaint and save the result to an HDR format. You need to make sure you save the EXIF tags with the image, though. When Qtpfsgui merges input frames, it sorts the images based on the exposure data embedded in each file's EXIF tags. If it cannot find the exposure data, Qtpfsgui will prompt you to enter it manually for each frame -- a hassle it is best to avoid.

Considering how useful and interesting the task that Qtpfsgui performs is, it is almost a shame that it is a standalone tool and not integrated into other photo apps. Integrating it into a workflow now means either processing and correcting the RAW files in a separate app first, then exporting them to TIFF for Qtpfsgui, or tone-mapping the RAW files in Qtpfsgui first, and touching up the output in another app second. Here's hoping we see Qtpfsgui's functionality make it to plugins for Krita, the GIMP, your favorite editor, and some RAW converters.

But what a minor nit-pick that really is. Qtpfsgui enables Linux users to do some fancy stuff -- both useful stuff like automating the correction of hard-to-fix images and wild and crazy stuff like generating those bizarre, artsy images that are such a craze on Flickr.

Share    Print    Comments   

Comments

on Tone-mapping HDR photos with Qtpfsgui

Note: Comments are owned by the poster. We are not responsible for their content.

With a name like Qtpfsgui, no wnder

Posted by: Anonymous Coward on May 24, 2007 01:43 PM
With a name like Qtpfsgui, is it any wonder 'Normal' people stay away from Linux? I mean really, could they take the geekness out it for change, try to look somewhat professional perhaps? How’s the built-in help system, does it exist? I know this is bad medicine for the Linux-zealots but it’s got to change if we’re to be taken seriously, as these same zealots so demand to be.

#

Re:With a name like Qtpfsgui, no wnder

Posted by: Anonymous Coward on May 24, 2007 04:40 PM
Qtpfsgui is shipped with a manual that can be found both online and also (offline) from the Help menu (along with a FAQ).
Here's the online version:
<a href="http://wiki.osphoto.org/index.php/Qtpfsgui_manual" title="osphoto.org">http://wiki.osphoto.org/index.php/Qtpfsgui_manual</a osphoto.org>

#

Re:With a name like Qtpfsgui, no wnder

Posted by: Anonymous Coward on May 25, 2007 05:12 AM
Qtpfsgui is actually a quite cool name. By its name you can say at once that

1) It's a Qt application
2) It's related to pfsm and thus -- to tonemapping and HDR
3) It's a GUI application

No other application provides that much information about itself just from its name<nobr> <wbr></nobr>:)

#

Re:With a name like Qtpfsgui, no wnder

Posted by: Nathan Willis on May 28, 2007 07:45 AM
Professional?

It's not like Qtpfsgui is a product name. It's a project started by one guy to perform a task that nothing else out there was doing. And, at that, a highly technical task that does not get performed by "normal" people with any frequency. Given those constraints, a functional name is appropriate.

When you see this code hit the mainstream, it isn't going to be a stand-alone tool anyway, it will be more useful as one part of a larger image editing environment -- see Boudewijn's note below about the Krita plugin.

Don't get me wrong, I'm a big fan of good project naming. But this is single-purpose code that will eventually serve as an integrated part of bigger projects; if we discounted small projects because we didn't like their names, we would have run the other direction -- screaming -- from GREYCstoration<nobr> <wbr></nobr>... and we would have then missed out on one of the best de-noising filters in Krita and GIMP land.

Nate

#

Re: With a name like Qtpfsgui, no wnder

Posted by: Anonymous [ip: 57.78.11.41] on January 28, 2008 06:41 PM
*#@!()%$%#@@#$##@ :-)

#

Krita hdr creation plugin in the works

Posted by: Anonymous Coward on May 24, 2007 08:22 PM
Cyrille Berger has been working on a Krita plugin for creating HDR images for a while, together with Balachandran Chandramenam. It's a Krita 2.0 plugin, which means that it's not ready for public consumption yet. Still... We're working on it: <a href="http://cyrilleberger.blogspot.com/2007_03_01_archive.html" title="blogspot.com">http://cyrilleberger.blogspot.com/2007_03_01_arch<nobr>i<wbr></nobr> ve.html</a blogspot.com>

Boudewijn Rempt,
Krita Maintainer

#

Use Hugin to align the images

Posted by: Administrator on May 25, 2007 10:19 PM
You can use panoramic tools like Hugin/Panotools to align all the images very accurately, including remapping to different lenses and distortion-corrections to cope with slight changes of distance. Save the output as multiple TIFF files (rather than combining them together directly using enblend) and then use a tool like this to perform the tone mapping.

<a href="http://hugin.sf.net/" title="sf.net">http://hugin.sf.net/</a sf.net>

Cheers,
Toby Haynes

#

Tone-mapping HDR photos with Qtpfsgui

Posted by: Anonymous [ip: 77.246.241.246] on February 21, 2008 09:41 AM
It appears like all three links to images in fact lead to one and the same file.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya