Erste Logik zur Bildänderung

Matrixmultiplikation und Gamma-Rücktransformation angewendet
This commit is contained in:
Max Sponsel 2020-06-27 10:54:20 +02:00
parent c3d4a04017
commit 2a4e394165

View File

@ -62,11 +62,6 @@ T_reversed = np.array([[5.47221206, -4.6419601, 0.16963708],
[-1.1252419, 2.29317094, -0.1678952], [-1.1252419, 2.29317094, -0.1678952],
[0.02980165, -0.19318073, 1.16364789]]) [0.02980165, -0.19318073, 1.16364789]])
# Multiplikation der einzelnen Pixelwerte
for i in range(rows):
for j in range(cols):
cb_image[i, j] = T.dot(cb_image[i, j])
# Simulationsmatrizen fuer Protanop # Simulationsmatrizen fuer Protanop
S_b = np.array([[0, 1.05118294, -0.05116099], #Simulationsmatrix fuer Protanopie S_b = np.array([[0, 1.05118294, -0.05116099], #Simulationsmatrix fuer Protanopie
@ -81,11 +76,22 @@ S_t = np.array([[1, 0, 0], #Simulationsmatrix fuer Tritanopi
[0, 1, 0], [0, 1, 0],
[-0.86744736, 1.86727089, 0]]) [-0.86744736, 1.86727089, 0]])
#choice = input("Bitte geben Sie den Typ der zu simulierenden Farbblindheit an:(B,D,T)")
#Multiplikation der einzelnen Pixel
for i in range(rows):
for j in range(cols):
cb_image[i, j] = T_reversed.dot(S_b.dot(T.dot(cb_image[i, j]))) #T^-1*S*T*RBG_values
sim_image = np.copy(cb_image)
sim_image = sim_image.astype('uint8')
#Rücktransformation der Gammawerte
for i in range(rows):
for j in range(cols):
for x in range(3):
sim_image[i, j, x] = int(reverseGammaCorrection(cb_image[i, j, x]))
cv2.namedWindow("Display") # Displaywindow erstellen cv2.namedWindow("Display") # Displaywindow erstellen
cv2.imshow("Display", image) # Bild zeigen cv2.imshow("Display", sim_image) # Bild zeigen
cv2.waitKey(0) # Fenster offen halten cv2.waitKey(0) # Fenster offen halten