The brightness of the image is changed by γ conversion.
#Import the library
import cv2
import numpy as np
This time, I will use the image of Lenna.
img = cv2.imread(r'../Lenna.jpg')
Set the value of γ and perform γ conversion.
gannma = 0.5
cvt_gannma = np.zeros([256,1],dtype=uint8)
for i in range(256):
cvt_gannma[[i],[0]] = 255 * (float(i) / 255) ** (1.0/gannma)
img_gannma = cv2.LUT(img,cvt_gannma)
Result of γ conversion
Recommended Posts