Search code examples
pythonopencvhdr

How to get luminance of an HDR image


I am currently working on a project where I have a bunch of HDR images and I need to get the median luminance of each image and plot them.

I am trying using opencv but I am unable to find a function or way to get the median luminance of an image. Is there any way to do it? I am sure there should be some ways but I am just can't see to find it.


Solution

  • Solved the issue thanks to the comment of @fmw42. Writing his comment as an answer so that it helps others.

    @fmw42 commented -

    convert to LAB colorspace and extract the L (luminance) channel. Then get the average (mean) of the luminance channel or the median of the luminance. See cv2.cvtColor() to change color spaces and see cv2.mean() to get the average or np.median() for the median.