|
|
|
|
|
|
|
|
print("Ungültiger Wert!!!")
|
|
|
print("Ungültiger Wert!!!")
|
|
|
return 1
|
|
|
return 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
'''
|
|
|
0.4124564 0.3575761 0.1804375 Transformationsmatrix fuer XYZ Werte aus gegebenen RGB Werten!
|
|
|
|
|
|
RGB2XYZ = 0.2126729 0.7151522 0.0721750
|
|
|
|
|
|
0.0193339 0.1191920 0.9503041
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
0.01775239 0.10944209 0.87256922 T*RGB_Farbverktor = LMS_Farbvektor
|
|
|
'''
|
|
|
'''
|
|
|
|
|
|
|
|
|
RGB2XYZ = np.array(
|
|
|
|
|
|
[[0.4124564, 0.3575761, 0.1804375],
|
|
|
|
|
|
[0.2126729, 0.7151522, 0.0721750],
|
|
|
|
|
|
[0.0193339, 0.1191920, 0.9503041]])
|
|
|
|
|
|
|
|
|
T = np.array([[0.31399022,0.63951294,0.04649755],
|
|
|
|
|
|
[0.15537241,0.75789446,0.08670142],
|
|
|
|
|
|
[0.01775239,0.10944209,0.87256922]])
|
|
|
|
|
|
|
|
|
'''
|
|
|
'''
|
|
|
3.2404542 -1.5371385 -0.4985314 Transformationsmatrix fuer RGB Werte aus gegebenen XYZ Werten!
|
|
|
|
|
|
XYZ2RGB = -0.9692660 1.8760108 0.0415560 (RGB nur ganzzahlig --> Runden!!)
|
|
|
|
|
|
0.0556434 -0.2040259 1.0572252
|
|
|
|
|
|
|
|
|
5.47221206 −4.6419601 0.16963708 Rücktransformationsmatrix (Inverse von T)
|
|
|
|
|
|
T_reversed = -1.1252419 2.29317094 −0.1678952 T_reversed Ü LMS_Farbvektor = RBG_Farbvektor
|
|
|
|
|
|
0.02980165 −0.19318073 1.16364789
|
|
|
'''
|
|
|
'''
|
|
|
|
|
|
|
|
|
XYZ2RGB = np.array(
|
|
|
|
|
|
[[3.2404542, -1.5371385, -0.4985314],
|
|
|
|
|
|
[-0.9692660, 1.8760108, 0.0415560],
|
|
|
|
|
|
[0.0556434, -0.2040259, 1.0572252]])
|
|
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
|
0.4002 0.7076 −0.0808 Transformationsmatrix fuer LMS Werte aus gegebenen XYZ Werten
|
|
|
|
|
|
M_HPE = −0.2263 1.1653 0.0457
|
|
|
|
|
|
0 0 0.9182
|
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
T_reversed = np.array([[5.47221206,-4.6419601,0.16963708],
|
|
|
|
|
|
[-1.1252419,2.29317094,-0.1678952],
|
|
|
|
|
|
[0.02980165,-0.19318073,1.16364789]])
|
|
|
|
|
|
|
|
|
M_HPE = np.array([[0.4002, 0.7076, -0.0808],
|
|
|
|
|
|
[-0.2263, 1.1653, 0.0457],
|
|
|
|
|
|
[0, 0, 0.9182]])
|
|
|
|
|
|
|
|
|
|
|
|
# for i in range(rows): #Durchgehen aller Pixel des Bildes
|
|
|
# for i in range(rows): #Durchgehen aller Pixel des Bildes
|
|
|
# for j in range(cols):
|
|
|
# for j in range(cols):
|