I'm working with the HDR+ Burst Photography Dataset. The burst RAW images are provided in DNG format. For each image, an additional low-resolution floating point lens shading map (encoded as .TIFF) is provided in order to perform lens shading correction.

I would like to programmatically correct the lens shading of the raw images using the provided gains but I can't find an article or paper that describes the correct procedure. What would be the formulas I need to implement in order to correctly apply such gains to the raw image?

  • 3
    \$\begingroup\$ vtc b/c This is a programming/math question. \$\endgroup\$
    – xiota
    Dec 9, 2019 at 16:38
  • \$\begingroup\$ This is an image processing question. Whether that processing is done using programming/math or screens and graduated filters in the darkroom, it is essentially the same thing. \$\endgroup\$
    – Michael C
    Dec 20, 2019 at 23:40

1 Answer 1


I would proceed in the following way:

  1. Upscale the low-resolution floating point lens shading map into the correct resolution. Use a proper upscaling algorithm that interpolates instead of the nearest neighbor algorithm.

  2. Open both images, the RAW image and the upscaled low-resolution lens shading map, as layers into an image in GIMP / Photoshop / similar image editor.

  3. Either multiply or divide the layers to create one single corrected layer. In the case of multiplying, the order doesn't matter but in the case of dividing, you want the numerator to be the RAW image and the denominator to be the lens shading map.

Whether multiplying or dividing is necessary depends on the type of the lens shading map: inverse or direct map.

For more accurate results, you might want to apply inverse gamma to the image before the multiplication / division and the forward gamma to the image after the multiplication / division. If doing this, be sure to utilize 16-bit precision!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.