Browse Source

Anpassung der Bildveränderung

Trotz Anpassungen sind noch einige Verbesserungen nötig: Grauanteile, wo keine sein sollten treten auf. Die Berechnungsalgorithmen müssen überprüft werden.
master
Max Sponsel 3 years ago
parent
commit
d7cb8c293e
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      Code/Dyschromasie.py

+ 4
- 4
Code/Dyschromasie.py View File

@@ -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

Loading…
Cancel
Save