diff --git a/Code/Dyschromasie.py b/Code/Dyschromasie.py index 7d690a7..b81006a 100644 --- a/Code/Dyschromasie.py +++ b/Code/Dyschromasie.py @@ -22,6 +22,7 @@ def gammaCorrection(v): print("Ungültiger Wert!!") return 1 + def reverseGammaCorrection(v_reverse): if v_reverse <= 0.0031308: return int(255 * (12.92 * v_reverse)) @@ -32,10 +33,10 @@ def reverseGammaCorrection(v_reverse): return 1 -cb_image = np.copy(image) #Kopie des Bildarrays -cb_image = cb_image.astype('float64') #Casting des Arrays auf Float +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 +# Korrektur des Gamma Faktors für alle Bildelemente for i in range(rows): for j in range(cols): for x in range(3): @@ -61,12 +62,28 @@ 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 +# Multiplikation der einzelnen Pixelwerte for i in range(rows): for j in range(cols): - cb_image[i,j] = T.dot(cb_image[i,j]) + 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 + [0, 1, 0], + [0, 0, 1]]) + +S_d = np.array([[1, 0, 0], #Simulationsmatrix fuer Deuteranopie + [0.9513092, 0, 0.04866992], + [0, 0, 1]]) + +S_t = np.array([[1, 0, 0], #Simulationsmatrix fuer Tritanopie + [0, 1, 0], + [-0.86744736, 1.86727089, 0]]) + +#choice = input("Bitte geben Sie den Typ der zu simulierenden Farbblindheit an:(B,D,T)") + -#Simulationsmatrizen cv2.namedWindow("Display") # Displaywindow erstellen