|
|
|
|
|
|
|
|
cols = image.shape[1] # Auslesen der Spaltenanzahl
|
|
|
cols = image.shape[1] # Auslesen der Spaltenanzahl
|
|
|
kanaele = image.shape[2] # Auslesen der Kanaele (3 fuer RGB, 1 fuer Graubild)
|
|
|
kanaele = image.shape[2] # Auslesen der Kanaele (3 fuer RGB, 1 fuer Graubild)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def gammaCorrection(v):
|
|
|
def gammaCorrection(v):
|
|
|
if v <= 0.04045 * 255:
|
|
|
if v <= 0.04045 * 255:
|
|
|
return float(((v / 255) / 12.92))
|
|
|
return float(((v / 255) / 12.92))
|
|
|
|
|
|
|
|
|
print("Ungültiger Wert!!")
|
|
|
print("Ungültiger Wert!!")
|
|
|
return 1
|
|
|
return 1
|
|
|
|
|
|
|
|
|
print(gammaCorrection(image[0,0,0]))
|
|
|
|
|
|
|
|
|
|
|
|
def reverseGammaCorrection(v_reverse):
|
|
|
def reverseGammaCorrection(v_reverse):
|
|
|
if v_reverse <= 0.0031308:
|
|
|
if v_reverse <= 0.0031308:
|
|
|
return int(255 * (12.92 * v_reverse))
|
|
|
return int(255 * (12.92 * v_reverse))
|
|
|
|
|
|
|
|
|
return 1
|
|
|
return 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cb_image = np.copy(image)
|
|
|
|
|
|
|
|
|
cb_image = np.copy(image) #Kopie des Bildarrays
|
|
|
|
|
|
cb_image = cb_image.astype('float64') #Casting des Arrays auf Float
|
|
|
|
|
|
|
|
|
|
|
|
#Korrektur des Gamma Faktors für alle Bildelemente
|
|
|
for i in range(rows):
|
|
|
for i in range(rows):
|
|
|
for j in range(cols):
|
|
|
for j in range(cols):
|
|
|
for x in range(3):
|
|
|
for x in range(3):
|
|
|
cb_image[i,j,x] = gammaCorrection(float(image[i,j,x]))
|
|
|
|
|
|
|
|
|
cb_image[i, j, x] = gammaCorrection(float(image[i, j, x]))
|
|
|
|
|
|
|
|
|
print(cb_image[0,0])
|
|
|
|
|
|
'''
|
|
|
'''
|
|
|
0.31399022 0.63951294 0.04649755 Transformationsmatrix zum Konvertieren vom linearen RGB zum LMS Farbraum
|
|
|
0.31399022 0.63951294 0.04649755 Transformationsmatrix zum Konvertieren vom linearen RGB zum LMS Farbraum
|
|
|
T = 0.15537241 0.75789446 0.08670142 Multiplikation aus Brucelindbloom und Hunt-Pointer-Estevez Matrixen
|
|
|
T = 0.15537241 0.75789446 0.08670142 Multiplikation aus Brucelindbloom und Hunt-Pointer-Estevez Matrixen
|