0

Hello I'm using opencv on python and I was wondering if there was a way to generalise the value of the parameter gamma on a set on images that have diffrents luminance( dark , bright and normal images) in order to have a a set of images in the same range of luminosity.

here is the code where i use my gamma :

 lookUpTable = np.empty((1,256), np.uint8)
 for i in range(256):
    lookUpTable[0,i] = np.clip(pow(i / 255.0, gamma) * 255.0, 0, 255) 
 img1 = cv2.LUT(img1, lookUpTable)

I'm not trying to use the same value of gamma but I'm looking for a way to change it automatically depending on the image luminosity.

I tried using the Image.getpixel function on images but i couldn't find a relation between the value of brightness and the gamma value.

coderAI
  • 1
  • 1
  • 2
    Search Google. Many papers on auto-gamma or adapative-gamma. For example, see https://www.researchgate.net/profile/Golam-Dastegir-Al-Quaderi/publication/309234778_An_adaptive_gamma_correction_for_image_enhancement/links/580e1eeb08aebfb68a51766b/An-adaptive-gamma-correction-for-image-enhancement.pdf and https://arxiv.org/pdf/1709.04427.pdf and https://resources.mpi-inf.mpg.de/tmo/logmap/logmap.pdf and https://asp-eurasipjournals.springeropen.com/articles/10.1186/s13634-016-0366-7 – fmw42 Jul 26 '22 at 15:58
  • I think your question would benefit from the addition of images representative of a *"dark"* image, a *"bright"* image and a *"normal* image. Then some indication of what you want. You could map the darkest pixel in each image to 0 and the brightest to 255. Or you could ensure all images have the same mean, of, say 128. Or you could ensure all images have the same mean and standard deviation.... – Mark Setchell Jul 26 '22 at 20:54

0 Answers0