From 2a4e39416573859254edd325e1a371bf8c77f175 Mon Sep 17 00:00:00 2001 From: Max Sponsel Date: Sat, 27 Jun 2020 10:54:20 +0200 Subject: [PATCH] =?UTF-8?q?Erste=20Logik=20zur=20Bild=C3=A4nderung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Matrixmultiplikation und Gamma-Rücktransformation angewendet --- Code/Dyschromasie.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Code/Dyschromasie.py b/Code/Dyschromasie.py index b81006a..05bd2ae 100644 --- a/Code/Dyschromasie.py +++ b/Code/Dyschromasie.py @@ -62,11 +62,6 @@ T_reversed = np.array([[5.47221206, -4.6419601, 0.16963708], [-1.1252419, 2.29317094, -0.1678952], [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 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.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.imshow("Display", image) # Bild zeigen +cv2.imshow("Display", sim_image) # Bild zeigen cv2.waitKey(0) # Fenster offen halten