hdr-nov06

Upload: erik-rainier

Post on 10-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 hdr-nov06

    1/4

    428 RPS Journal November 2006

    TECHNICAL

    At the heart of every digital camera is a sensor thatconverts incident light into a digital image. Anumber of factors affect the fidelity with which

    the original scene is recorded in digital form. Of these,the resolution of the sensor has received the mostattention from camera manufacturers, with digitalcameras boasting ever-higher megapixel counts.

    However, relatively little attention has been paid to therange of values that each pixel may represent. Jpegimages recorded by most digital cameras represent thecolour at each pixel with a single byte (8 bits) for each of the red, green and blue colour channels. Although this

    allows more than 1.6 million different colours to berepresented, each colour channel of a pixel can only take

    HIGH DYNAMIC RANGEDIGITAL PHOTOGRAPHYClipped highlights and shadows are a common problem for digital camera users. Recentresearch in computer graphics provides a solution, in which a high dynamic range image isconstructed from a sequence of different exposures. Guy J Brown FRPS explains

    An average exposure of the interior scene (left)shows clipping in boththe highlights andshadows. As a result,the window areas aregrossly overexposed andthere is a loss of shadowdetail, as indicated bythe histogram (lowerleft). Above: a highdynamic range imageconstructed from asequence of bracketedexposures retains detailthroughout the tonalrange. Thecorrespondinghistogram (right) is notclipped.

  • 8/8/2019 hdr-nov06

    2/4

    429RPS Journal November 2006

    STEFAN LORANT

    one of 256 possible values. This means that scenescontaining very bright and very dark areas cannot beeffectively recorded, leading to the familiar problem of clipped highlights and/or shadows. A common exampleof such a scene is a window-lit interior, as shown on theprevious page, below. Note that the correspondinghistogram is clipped at both ends; some shadow detail isrecorded as pure black, and some highlight as pure white.The situation can be improved to some extent by usingthe cameras Raw image format, which typically uses 10or 12 bits per colour channel. However, there are stillmany circumstances in which the limited dynamic rangeof a digital camera (typically no more than 8.5 stops) isexceeded by high contrast scenes.

    Recent research in computer graphics offers asolution to this problem, in the form of high dynamicrange (HDR) imaging. In comparison, the imagesrecorded by conventional digital cameras are regardedas low dynamic range (LDR). A HDR image of thewindow-lit interior is shown at the top of the previouspage; note that detail recorded in the highlight andshadow areas is much improved.

    Digital cameras that are able to directly capture thefull dynamic range of a high-contrast scene arecurrently in development, though only a small numberof commercial solutions are currently available, andthey are either very expensive or tailored to specificapplications, such as surveillance video capture.

    An alternative to direct HDR capture is to record the

    scene using a sequence of bracketed LDR exposures,which are then combined using software. The

    underlying principle is that each exposure in thesequence will contain some pixels that are properlyexposed, and others that are under- or over-exposed.By combining the correctly exposed pixels from eachframe and excluding the clipped pixels, a HDR imagecan be constructed.

    If the response of the camera to light were perfectlylinear, then each pixel could be divided by its exposuretime and averaged (ignoring clipped pixels) to give a HDRimage. In practice, however, image sensors do not measurelight in a perfectly linear manner, and cameramanufacturers apply processing to boost contrast, suppressnoise and give a more film-like response. Since theresponse function of the camera is unknown (and indeed isconsidered proprietary information by the cameramanufacturer) it must be deduced by the HDR software.This may require a separate calibration stage, or anapproximate response curve can be used.

    HDR software may also compensate for other factors thataffect the correspondence between frames of the exposuresequence, such as lens flare, ghosting caused by movingobjects and misalignment due to movement of the camera.

    Using this approach, HDR image capture thereforeinvolves no more than taking a sequence of bracketedexposures with a conventional digital camera.However, for good results, the following practicalconsiderations should be taken into account: since thetechnique requires multiple exposures of the samescene, it is most suited to scenes that do not contain

    significant motion. The best result will be obtained whenthe camera is supported by a tripod. Hand-holding the

    Above: Construction of a HDR image from fivebracketed exposures.Simply scaling the valuesof the HDR image foroutput to a screen orprinter is not sufficient;the resulting image istoo dark and lacks localcontrast. Tone mappinggives a much betterrendition of the scene.

  • 8/8/2019 hdr-nov06

    3/4

    430 RPS Journal November 2006

    TECHNICAL

    camera is possible but not recommended since mostHDR software provides the facility to place misalignedimages in register. If you have no option but to handhold thecamera, use automatic bracketing and continuous drive.

    Only vary the exposure time when bracketing. Use manualor aperture priority mode, and keep the ISO constant. White

    balance should also not be changed during the sequence of exposures. As usual when using a digital camera, optimumquality will be obtained by storing images in Raw, and thenconverting them to a lossless file format such as Tiff. Also,some HDR software (such as PhotoMatix) is able toconstruct a HDR image directly from Raw files.

    It is advisable to shoot an odd number of bracketedexposures, such that the middle frame has an averageexposure for the scene. To meter for the middle exposure,either use the cameras matrix metering, or use an averageof spot meter readings taken from the highlights andshadows. Starting from the middle exposure, overexposeand underexpose in steps of two stops, until the camerashistogram display indicates that the shadows andhighlights are not clipped. In practice most scenes can be

    recorded with three or five exposures.The flow diagram on the previous page illustrates the

    process of constructing a HDR image from five exposures.In the longest exposure (+4 stops), highlights are severelyclipped but the shadows are well recorded. Similarly, theshortest exposure (-4 stops) records full highlight detail,but clips the shadows. By combining the unclipped pixelsover the whole sequence of images, the full dynamic rangeof the scene can be accurately recorded.

    Once a HDR image is produced, it must be encodedand stored using an appropriate file format. It shouldbe noted that there are fundamental differencesbetween HDR and LDR image encodings. Each pixelin a LDR image is usually represented by a 24-bitnumber that describes its position in a colour space,such as Adobe RGB. In contrast, the pixel values in aHDR image are directly related to the radiance in thescene that was photographed.

    A number of file formats have been developed thatallow HDR images to be encoded in an efficientmanner. The most common of these is RadianceRGBE format, which has a .hdr extension. RGBEencoding requires 32 bits per pixel, but allows a fargreater dynamic range to be represented thanconventional 24-bit RGB encodings.

    A far wider range of illumination is captured by a HDRimage than can be reproduced by a display device, or inprint. Therefore, the problem arises of how to display aHDR image in a manner that is visually acceptable.Simply scaling the contrast range to fit the output deviceis not sufficient the resulting image is too dark andbears little resemblance to the original scene. Display of HDR images therefore involves a tone mappingproblem: how to preserve detail in the HDR image whilereducing its dynamic range to fit the output device. Sincethe human visual system solves a similar problem, muchinspiration for tone mapping algorithms has come fromthe study of visual perception.

    Broadly, tone mapping algorithms can be classifiedas global or local. Global algorithms compress thedynamic range of a HDR image by operating on eachpixel independently, whereas local algorithms adjustthe value of each pixel depending on the value of itsneighbouring pixels. The latter more closely model

    the behaviour of the human visual system, and tend togive the more visually pleasing result.

    From a photographers point of view, tone mappingalgorithms may be regarded as analogous to methods of contrast control used during wet printing. Global tonemapping algorithms are akin to selecting an appropriategrade of printing paper. Similarly, local tone mappingmay be regarded as a means of automatically performing

    dodging and burning of local areas.When evaluating HDR software, it is the

    characteristics of the tone mapping algorithm that willbe of most concern to the digital photographer. Thispoint is illustrated in the following two sections,which compare the HDR tools provided by PhotoshopCS2 with a specialist application called PhotoMatix.The following descriptions refer to versions of thesoftware running under Mac OS X (versions runningunder Microsoft Windows are also available).

    Support for HDR images was introduced in PhotoshopCS2. Select File > Automate > Merge to HDR andchoose the images to combine. An option is provided foraligning the images, if required. No separate calibrationstage is needed, since Photoshop computes the camera

    response from the source images.Controls are then displayed for setting the bit depth

    and white point of the resulting image. If the 32-bits-per-channel option is chosen, then Photoshop keepsthe result as a HDR image, and the selected whitepoint only affects the image preview. A limitednumber of functions are then available for furthermanipulation of the image (for example, it can besharpened but may contain only one layer). It is likelythat full support for 32-bit images will be provided inlater versions of Photoshop.

    If the 8- or 16-bits-per-channel option is selected,then the image values are clipped according to theselected white point, and tone mapping controls aredisplayed. There are four possible options here:Exposure and gamma provides controls foradjustment of the overall image brightness andcontrast; Highlight compression compresses thehighlight values of the HDR image into a suitablerange; Equalise histogram reduces the dynamicrange while attempting to preserve contrast; and Localadaptation a local tone mapping algorithm whichalso provides for overall adjustment by a tone curve.Controls are provided for setting the size of theneighbourhood that is taken into account whenadjusting the value of each pixel.

    The first three of these tone mapping algorithmsoperate globally, and can be computed rapidly. Theequalise histogram algorithm works quite well, but theothers rarely give acceptable results. The localadaptation algorithm requires much more computationtime, but usually gives the most pleasing image.

    In PhotoMatix meanwhile, HDR images are generatedby selecting HDR > Generate and choosing the images tocombine. Options are provided to use a standard responsecurve or calculate the cameras response curve from theimages (the standard curve usually works well). Theimages can also be aligned if required. This can either bedone automatically, or by a semi-manual method, inwhich the user specifies control points that mark thesame object in different frames.

    The HDR image is then computed and displayedwith a viewer that allows small sections of the image tobe magnified and viewed with an automatic exposure

    adjustment. A histogram can also be displayed.The HDR image is then tone mapped by selecting

  • 8/8/2019 hdr-nov06

    4/4

    431RPS Journal November 2006

    HDR > Tone Mapping. PhotoMatix provides two tonemapping algorithms, a global algorithm called thetone compressor and a local algorithm called thedetails enhancer. The tone compressor providescontrols to determine the overall brightness andcontrast of the image, and to set the white and black

    points. It runs quickly and produces reasonableresults. However, most will prefer the look of thedetails enhancer algorithm. This requires morecomputation time since it works locally, but oftenproduces beautiful results. The details enhancer alsoprovides more control, allowing the degree of localcontrast enhancement to be determined. As before,there are controls for setting the white and black pointsand overall image brightness, and the coloursaturation can also be adjusted.

    PhotoMatix also provides other functions to combineshadow and highlight detail from multiple exposureswithout actually computing a HDR image. The simplest of these is Combine > Average which averages theexposures. Three other highlights and shadows options

    are provided under the Combine menu, all of which tendto produce more natural results than tone-mapping, andrequire little or no user intervention. On the downside, theyare not as effective at preserving local contrast and mayproduce rather flat looking images.

    PhotoMatix has a comprehensive batch processingfacility, that allows the algorithms described above tobe applied to a directory containing a large number of images (eg by combining every three images into aHDR image and then tone mapping the result andsaving it). The batch processing facility allows HDRimages to be computed directly from the Raw files of most camera manufacturers.

    The image quality obtained from HDR software ismainly determined by the tone mapping algorithm, andPhotoMatix scores highly over Photoshop CS2 in thisregard. The PhotoMatix details enhancer does a better

    job of rendering shadow detail than the comparable localadaptation algorithm in Photoshop, and produces imageswith a distinctive ethereal appearance.

    PhotoMatix is polished software, backed by a helpfultechnical support team, and is highly recommended. Afurther point is that HDRSoft, which marketsPhotoMatrix, also markets the tone-mapping part of PhotoMatix in the form of a Photoshop plug-in. Thisallows its tone-mapping algorithm to be incorporatedinto a Photoshop workflow.

    In the near future, it is likely that HDR imagingwill become the norm rather than the exception.Some camera manufacturers (notably Fujifilm)have already introduced sensors with extendeddynamic range. However, until HDR camerasbecome commonplace, the software solutionsreviewed here offer an effective means of handinghigh contrast scenes. In addition, tone-mappedHDR images have an unusual tonality that can beexploited for pictorial effect.

    Guy J Brown [email protected]

    The following text is recommended for those seeking further reading on the subject: High dynamic range imaging: Acquisition, display and image-based lighting by Erik Reinhard, Greg Ward, Sumata Pattanaik and

    Paul Debevec. Morgan Kaufmann Publishers (ISBN 0- 12-585263-0).

    Result of tone mappingthe same HDR imageusing details enhancerin PhotoMatix (above)and local adaption inPhotoshop CS2 (left).

    Adobe (Photoshop CS2) www.adobe.com

    HDRsoft (PhotoMatix) www.hdrSoft.com