Matt Pucevich, 11/12/04
Using the algorithm and gsolve function provided in Debevec & Malik 1997, I have written a set of Matlab functions which will build a HDR image from a set of images of the same scene with varying exposure times. For details on the algorithm, see the above paper.
srcimnames: An Nx1 cell array of the names of the image files belonging to a single HDR image series.
srcDTs: A row matrix containing the exposure times of the N images supplied to srcimnames
lmb: The lambda term described in the paper; it is a weighting parameter used to control the importance of smoothness in the response curve.
getRcurve must be called once (and need only be called once if all images to be used were taken with the same camera). It returns [g, logDTs], where g is a 256x3 matrix containing the response curves for the R, G, and B channels columnwise. Once the response curve has been recovered, then one of three "second" functions can be called to actually construct the HDR image in different ways. The three functions are HDRGloOp, HDRLinClamp, and HDRLog [All of these functions return the HDR image they construct].
HDRGloOp uses the global operator to construct the image, it takes 5 arguments:
srcimnames: An Nx1 cell array of the names of the image files belonging to a single HDR image series.
outfilename: The name to which the generated HDR image will be saved, in addition to being returned.
g: The response curve obtained from getRcurve.
logDTs: The elementwise ln of srcDTs.
scale: A scaling factor to be applied to the pixal values after HDR image computation.
HDRLinClamp produces its image by linearly scaling a given range of the radiance values. It takes 6 arguments:
srcimnames: An Nx1 cell array of the names of the image files belonging to a single HDR image series.
outfilename: The name to which the generated HDR image will be saved, in addition to being returned.
g: The response curve obtained from getRcurve.
logDTs: The elementwise ln of srcDTs.
lowclamp: A float from 0 to 1 representing the lower bound of the radiance values to scale.
hiclamp: A float from 0 to 1 representing the upper bound of the radiance values to scale.
HDRLog produces its image by log scaling the entire range of radiance values. It takes 4 arguments:
srcimnames: An Nx1 cell array of the names of the image files belonging to a single HDR image series.
outfilename: The name to which the generated HDR image will be saved, in addition to being returned.
g: The response curve obtained from getRcurve.
logDTs: The elementwise ln of srcDTs.
Examples: srcimnames = {'im1.jpg';'im2.jpg';'im3.jpg';'im4.jpg'}; srcDTs = [1 1/2 1/4 1/8]; HDRim = GDRGloOp(srcimnames, srcDTs, g, logDTs, .5); Will produce a global operator HDR image, multiplying the radiance values by .5 before applying the global operators. HDRLinClamp(srcimnames, srcDTs, g, logDTs, 0.0, 0.001); will produce a linearly scaled HDR image, scaling the values between 00.0% and 00.1% of the radiance values (clamping all values outside the two bounds to 0 or 255 respectively). HDRLog is self explanatory.
Below are results obtained with my program using images I took with Ben Hollis.
Base images of St. Peter's Chathedral (near Pitt) with exposure times of .0125s, .05s, .4s and 2s:
Resulting HDR images using the Global Operator, Log scaling, and linear scalings (0-100%, 0-1%, and 0-.1% respectively)
Base images of "Studio C" in the drama building. Exposure times are .0025s, .01s, .1s, .6s, 4s:
Resulting HDR images using the Global Operator, Log scaling, and linear scalings (0-100%, 0-1%, and 0-.1% respectively)
Base images of a panoramic set of three photographs taken from the 2nd floor of the UC near the basketball courts. Exposure times for the high angle set are 1/640s, 1/100s, and 1/15s; exposure times for the middle angle set are 1/640s, 1/100s, 1/25s, and 1/5s; and exposure times for the low angle set are 1/60s, 1/15s, and 1/5s respectively.
Resulting HDR panorama using the Global Operator (w/ 1% scaling)