VFX Project - HDR
In this project, we implemented Paul Debevec’s method to assemble an HDR image. For extension, we implemented MTB alignment algotirhm.
Link to Code: Github
Run the code
Use python3 to run the code, and the
dataset is the path to image resource.
openCV and exifread is necessory to run the program.
pip install opencv-python
For HDR image recovery, we implemented Paul Debevec’s method.
Using RGB channels
Separate the image into RGB channels.
For each channel, we randomly choose 100 pixels to find its response curve. For solving the over-determined linear system, we use numpy’s
Construct the raidance map for each channel and merge them together. Then, we can get the HDR image.
We tried to implement the Gradient Domain algorithm for tone mapping, which should have worked fine if coded properly, but we failed to do so. (The code is still included.) We now use openCV’s built-in tone mapping method to transfer the HDR image into a LDR one.
However, though the quality is tolerable, some overexposed spots we can’t eliminate appear in some cases.
Using YCbCr channels
Then, we tried to convert the color space from RGB to YCbCr, and only reconstruct the HDR image of Y channel, which represents the luminance. For the chroma channels, we weighted average them by the luminance difference between the original photos and the recovered one. With this method, the color is better preserved, and the recovered HDR image seems more like the original photo. However, it sometimes results in strange HDR image which has too strong color saturation.
Here is an example of the result of our MTB alignment. The two HDR images are generated from the same image set, but the right one was processed after aligning.
What We Learned
The most interesting part of this project is how response curve is constructed. It is our first time to know how math, especially linear algebra, is so important for creating and implementing an algorithm.
Me & ZL Yu