[PYTHON] A memorandum regarding γ conversion

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. Lenna.jpg

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 image.png

Recommended Posts

A memorandum regarding γ conversion
A memorandum about matplotlib
A memorandum about Nan.
A memorandum regarding Wifi connection when installing Arch Linux
A memorandum of kernel compilation
A small memorandum of openpyxl
A memorandum about Python mock
A memorandum of using eigen3
A memorandum regarding the acquisition of the Python3 engineer certification basic exam
A memorandum when using beautiful soup
A memorandum to change to Manjaro Linux
[Python] A memorandum of beautiful soup4
"Kaggle Memorandum" Conversion to One-hot Vector
A memorandum of closure survey contents