Browse Source

Erste Logik zur Bildänderung

Matrixmultiplikation und Gamma-Rücktransformation angewendet
master
Max Sponsel 4 years ago
parent
commit
2a4e394165
1 changed files with 13 additions and 7 deletions
  1. 13
    7
      Code/Dyschromasie.py

+ 13
- 7
Code/Dyschromasie.py View File

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

Loading…
Cancel
Save