Create HDR images from LDR inputs:
| (left) LDR input | (middle) Exposures taken from the predicted HDR | (right) Tone mapped HDR |
Weights and code for:
ExpandNet: A Deep Convolutional Neural Network for High Dynamic Range Expansion from Low Dynamic Range Content
Demetris Marnerides, Thomas Bashford-Rogers, Jonathan Hatchett and Kurt Debattista
Paper will be presented at Eurographics 2018.
Requires the PyTorch library along with OpenCV.
First follow the instructions for installing PyTorch.
To install OpenCV use:
conda install opencv -c menpo
The script accepts an LDR image as input, and creates an HDR Image prediction (.hdr file).
python expand.py ldr_input.jpg
Can also do batch processing
python expand.py *.jpg
To put results in a separate directory:
python expand.py *.jpg --out results/
Results can be resized and filenames can be tagged:
python expand.py test.jpg --resize True --height 960 --width 540 --tag my-tag
If a GPU is available and Pytorch detects it then the conversion will happen on the GPU. To force CPU usage (slower) set --use_gpu False
.
The network operates on patches to limit memory usage when expanding high resolution images. The flag --patch_size
adjusts the size.
The resulting HDR Image can be tone mapped using the TMOs provided by OpenCV, or using the exposure operator.
python expand.py test.jpg --tone_map reinhard
Use --video True
(along with a tone mapper --tone_map
) to test video conversion.
WARNING This is completely new and experimental. Very slow and memory consuming! Should only test short low-res clips. The model is not designed for videos thus flickering occurs which is reduced in the code by smoothing luminance percentile curves.
In the following example, on the left is the LDR video input and on the right is the (reinhard) tone mapped prediction.
Any tips to improve this are welcome!
There is a very easy to use online viewer at openhdr.org which also has tone mapping functionalities!
Contact: [email protected]