From d7cb8c293eb3cc4155b408ad207362230d53385f Mon Sep 17 00:00:00 2001 From: Max Sponsel Date: Sat, 27 Jun 2020 11:24:07 +0200 Subject: [PATCH] =?UTF-8?q?Anpassung=20der=20Bildver=C3=A4nderung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trotz Anpassungen sind noch einige Verbesserungen nötig: Grauanteile, wo keine sein sollten treten auf. Die Berechnungsalgorithmen müssen überprüft werden. --- Code/Dyschromasie.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Code/Dyschromasie.py b/Code/Dyschromasie.py index 05bd2ae..4c47eae 100644 --- a/Code/Dyschromasie.py +++ b/Code/Dyschromasie.py @@ -5,7 +5,7 @@ import sys # Einlesen des Bildes script_dir = sys.path[0] -path = script_dir[:-4] + "Beispielbilder\lena.jpg" +path = script_dir[:-4] + "Beispielbilder\grocery_store.jpg" image = cv2.imread(path) # Einlesen des Bildes (noch hardcodiert, sollte dann in GUI gehen) rows = image.shape[0] # Auslesen der Zeilenanzahl @@ -64,7 +64,7 @@ T_reversed = np.array([[5.47221206, -4.6419601, 0.16963708], # Simulationsmatrizen fuer Protanop -S_b = np.array([[0, 1.05118294, -0.05116099], #Simulationsmatrix fuer Protanopie +S_p = np.array([[0, 1.05118294, -0.05116099], #Simulationsmatrix fuer Protanopie [0, 1, 0], [0, 0, 1]]) @@ -80,7 +80,7 @@ S_t = np.array([[1, 0, 0], #Simulationsmatrix fuer Tritanopi #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 + cb_image[i,j] = T_reversed.dot(S_p).dot(T).dot(cb_image[i,j]) sim_image = np.copy(cb_image) sim_image = sim_image.astype('uint8') @@ -89,7 +89,7 @@ sim_image = sim_image.astype('uint8') 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])) + sim_image[i, j, x] = reverseGammaCorrection(cb_image[i, j, x]) cv2.namedWindow("Display") # Displaywindow erstellen