Learn how to create a high dynamic range (HDR) image using Python and OpenCV

HDR images encompass the information of multiple pictures with different exposures. In a scene which the source of light is uneven, a single shot may overexpose certain areas of the image and details will be lost due to elevated brightness. Conversely, this picture may also present underexposed areas which will also lead to information loss.

To create an HDR image you will need:

  1. Take pictures with different exposures. Minimum of 2, generally 3, you can use more than 3 images but it will take a lot of CPU resources.
  2. Align the images. Even if you use a tripod you will need to perform this step (we are talking about pixel level alignment). Not properly aligning your image will lead to artifacts and ‘ghosts’ in your HDR image.
  3. Merge the aligned images into one.
  4. Perform tone mapping on the merged image. In nature the minimum possible brightness is zero but the maximum is not limited to 255, in fact there is no limit to it, it can be infinity. For this reason we need to map the image obtained in the third step to a (0, 255) range. This can be achieved with tone mapping.

#hdr #opencv #computer-vision #python #opencv #opencv python

A Simple HDR Implementation on OpenCV Python
20.65 GEEK