Saturday, October 16, 2010

Tryst with HDR on Linux


Another delightful experience with Ubuntu and opensource in general.

I had been to a Raigad trip recently, and had got some pics in my DSLR. On checking out the photos, I realised I had couple of genuine cases for trying out HDR technique. Unfortunately, for each of the cases, I had only one image, and not an exposure-bracketed set of three images, as is usually required for composing an HDR image. Yet I had to try something. So what I did was to prepare three (virtually) exposure-bracketed copies from the same RAW image through ufraw, and thou
ght of feeding them into some HDR software.

Having those three differently exposed images in hand, allowed me to start looking for an HDR software for Linux. It's sometimes disappointing to see lots of such softwares are created mainly for the Windows platform, or sometimes for a Mac. An example would be the popular one - Photomatix

On my previous Ubuntu (Jaunty), I had this Qtfpsgui software. But it didn't appeal, and confused me a bit. Besides, it requires K-Desktop libraries, which would take quite some time for download and installation. So I kept searching for an alternative. And this is when I chanced upon this software called - Enfuse. It's available as part of the Enblend software pack for Linux, and is there in the Ubuntu repository. So all you need to do, to install it, is to type "sudo apt-get install enblend" in the terminal and press enter!! I got it installed
on my Lucid Lynx setup.

In addition to Enfuse and Ufraw, I used one enfuse_raw.sh script mentioned on this page
. That script uses ufraw in batch mode to expose a RAW file using different exposure compensation levels. It then uses enfuse to combine those images into an HDR image. So all you have to do is - to feed your RAW file to the enfuse_raw.sh script and specify how many different expousures to process/extract from the RAW file, for combining into an HDR. Run the command, wait for maybe couple of minutes, and bingo! Your HDR image is ready.

Here, check these few images after they were processed into HDR using ufraw-enfuse combo on Linux. To emphasise how HDR has impacted the image details, against mere exposure adjustments, I have prepared a collage of each HDR (big size) surrounded by exposure adjusted images (thumbnails). I am sure you will appreciate what a fine job Enfuse does.

1. Varandha Ghaat:
The mountain on the left side is in dark shadows. You increase the exposure, the details in the shadow become clearer, but the sky and the area in sunlight blows out. Decrease the exposure, skies and the area in the sunlight is detailed but details in the shadow are gone. Enter HDR.


2
. Shivaji Maharaj:
Similar case here. Increase the exposure to get details in the statue, and you end up blowing up the blue sky white. Decrease the exposure, get a cool blue sky, but the statue appears as a silhoutte. Now check the HDR.



3. Varandha Ghaat (again):
Same dilemma. Left side area is in dark shadow, while the right side area is in bright sunlight. Camera doesnt know how to balance. Hire HDR.



Summary of what I did:
1. Install enblend and ufraw - "sudo apt-get install enblend, ufraw"
2. Get the enblend_raw.sh script from this page - http://ubuntuforums.org/showthread.php?t=741161
3. Feed the RAW file to the script. e.g. "./enfuse_raw.sh my_snap.raw -3"

Time to marvel at what you can quite easily achieve using opensource, without spending a penny. *Legally*.

No comments: