Saturday, March 29, 2008

HDR Photography

I just recently treated myself to a new digital camera. I was tired of my little point-and-shoot since I'm used to an SLR. I hesitated to get a digital SLR because they were so expensive and I wanted one that would be compatible with all the Minolta lenses I have for my Maxxum film SLR bodies. The one I chose, and found a good deal on, is the Sony alpha 200.

Sony purchased the digital camera business from KonicaMinolta a few years back, and turned the Maxxum 7D digital SLR into the alpha 100. KonicaMinolta is now concentrating on computer imagery like laser printers.

I've been a big fan of Minolta cameras for a long time, thanks to my Great Uncle Jimmy. He always had Minolta SLR cameras...probably 15 to 20 different ones...over the years. My dream camera for years was the Maxxum 7000. This was the first modern autofocus electronic control camera ever. I did not, however, get one of these $1,000+ cameras until the late 90's...which I bought used for $170. I've run copious amounts of film through this camera for everything from vacation snaps to the occasional wedding.

Minolta was never really the tops in pro cameras for reasons that I could never figure out. Sure Nikon and Canon are great cameras, but I've just always preferred the Minoltas. I like Nikons, they are just really expensive and Canon's (the affordable ones) bodies and lenses have always seemed too lightweight and flimsy. My pal Chris swears by Canons and he's a burnt-out pro...which is why he's in the IT industry now.

Anyhow, HDR is an area that has interested me for a while now. HDR is "High Dynamic Range" photography. It is essentially processing a set of pictures to get to an image that emulates what the human eye would see naturally.

Fig. 1: The original image.

The picture above is an image of the front window of my living room. I took it when the sun was up high around midday. The window is bright and the room dark. The actual image that my eye saw was a relatively bright interior and a bright but distinct exterior...the lighting was "even". To the camera, the bright area overrides the CCD and overexposes the light areas and underexposes the dark areas. This is, unfortunately, unavoidable. Why? The human eye has a high dynamic range and can determine and adjust your perception to even out the lighting of the image. The camera has a limited dynamic range. Basically, the eye is sensitive to a wider range of light than the CCD in a digital camera (or even film). But with HDR, this can be corrected to some extent.

To create an HDR image, you have to have an area that has wide variation of light intensity. You can work with images that don't, but I've not had real good luck with it...but I'm not a pro.

HDR requires three or more images. One, is your normal image...mine was the one above in figure 1. This was taken 28mm, f4 at 1/80 sec. Then you need one or more overexposed images, and one or more underexposed images. The overexposed image will brighten up the dark areas of the original, and the underexposed ones will darken the lighter areas. For the image above I took three under at 1, 2 and 3 stops and three over at 1, 2 and 3 stops. How you do this, however, can be important. Adjust the shutter speed and NOT the aperture. Adjusting the aperture will affect the focal length of the image and can cause areas to sharpen or blur as compared to the original.

The other images I took were at a shutter speed of 1/40, 1/20 and 1/10th of a second for the overexposed images, and 1/160, 1/320 and 1/500th of a second for the underexposed.

To combine the images, I used GIMP 2.4 (an open-source image editor). I opened the original as the background, then the other six images as layers in the same image. To create the HDR image, the idea is to remove the unnecessary parts of the over and underexposed images and include them in the original. To do this, you need to create a mask of the image. GIMP has the facility to create a mask from the layer automatically, and I created a grayscale mask for each layer. On the overexposed image, the grayscale layer needs to be inverted. This is because the mask's dark areas will become transparent, leaving the wanted details of the overexposed image (lighter versions of the dark areas of the image above) intact to be layered upon the original. Likewise, a non-inverted grayscale image is used as a mask for the underexposed areas. This leaves the wanted details of the underexposed areas (the light areas of the original) to be layered on the original.

This all sounds very complicated and can be for the first few times you do it. A great tutorial on how to do HDR with the GIMP can be found here on Instructables.

In the end, I think it came out pretty well, considering that it was not a very good selection of a subject. But, here is the final result.

Fig. 2: The resulting HDR of the image in Figure 1.

You can now see the detail of the furniture and plants in the living room, as well as the detail of that which is outside the window. No adjustments were made to the images, other than the application of the layer masks. I did not use the image taken at 1/40th of a second since it made the interior much to dark. Using GIMP, you can turn layers on and off indiscriminately to see how the image will look.

This is something that I am sure I will play with more in the future.

No comments: