|
|
@@ -7,6 +7,7 @@ import numpy as np |
|
|
|
|
|
|
|
|
|
|
|
class Dyschromasie:
|
|
|
|
global simGrad
|
|
|
|
cb_image = np.array([]).astype('float64')
|
|
|
|
sim_image = np.array([]).astype('uint8')
|
|
|
|
|
|
|
@@ -65,6 +66,16 @@ class Protanopie(Dyschromasie): |
|
|
|
for x in range(3):
|
|
|
|
self.sim_image[i, j, x] = self.reverseGammaCorrection(self.cb_image[i, j, x])
|
|
|
|
|
|
|
|
# Anpassung fuer den Slider
|
|
|
|
if(simGrad.get() != 0):
|
|
|
|
for i in range(rows):
|
|
|
|
for j in range(cols):
|
|
|
|
for x in range(3):
|
|
|
|
if self.sim_image[i, j, x] > img[i, j, x]:
|
|
|
|
self.sim_image[i, j, x] = img[i, j, x] + abs(self.sim_image[i, j, x] - img[i, j, x])* (simGrad.get()/100)
|
|
|
|
|
|
|
|
elif self.sim_image[i, j, x] < img[i, j, x]:
|
|
|
|
self.sim_image[i, j, x] = self.sim_image[i, j, x] + abs(img[i, j, x] - self.sim_image[i, j, x])* (simGrad.get()/100)
|
|
|
|
return self.sim_image
|
|
|
|
|
|
|
|
|
|
|
@@ -95,6 +106,18 @@ class Deuteranopie(Dyschromasie): |
|
|
|
for j in range(self.cols):
|
|
|
|
for x in range(3):
|
|
|
|
self.sim_image[i, j, x] = self.reverseGammaCorrection(self.cb_image[i, j, x])
|
|
|
|
|
|
|
|
# Anpassung fuer den Slider
|
|
|
|
if (simGrad.get() != 0):
|
|
|
|
for i in range(rows):
|
|
|
|
for j in range(cols):
|
|
|
|
for x in range(3):
|
|
|
|
if self.sim_image[i, j, x] > img[i, j, x]:
|
|
|
|
self.sim_image[i, j, x] = img[i, j, x] + abs(self.sim_image[i, j, x] - img[i, j, x]) * (simGrad.get() / 100)
|
|
|
|
|
|
|
|
elif self.sim_image[i, j, x] < img[i, j, x]:
|
|
|
|
self.sim_image[i, j, x] = self.sim_image[i, j, x] + abs(img[i, j, x] - self.sim_image[i, j, x]) * (simGrad.get() / 100)
|
|
|
|
|
|
|
|
return self.sim_image
|
|
|
|
|
|
|
|
|
|
|
@@ -125,6 +148,18 @@ class Tritanopie(Dyschromasie): |
|
|
|
for j in range(self.cols):
|
|
|
|
for x in range(3):
|
|
|
|
self.sim_image[i, j, x] = self.reverseGammaCorrection(self.cb_image[i, j, x])
|
|
|
|
|
|
|
|
# Anpassung fuer den Slider
|
|
|
|
if (simGrad.get() != 0):
|
|
|
|
for i in range(rows):
|
|
|
|
for j in range(cols):
|
|
|
|
for x in range(3):
|
|
|
|
if self.sim_image[i, j, x] > img[i, j, x]:
|
|
|
|
self.sim_image[i, j, x] = img[i, j, x] + abs(self.sim_image[i, j, x] - img[i, j, x]) * (simGrad.get() / 100)
|
|
|
|
|
|
|
|
elif self.sim_image[i, j, x] < img[i, j, x]:
|
|
|
|
self.sim_image[i, j, x] = self.sim_image[i, j, x] + abs(img[i, j, x] - self.sim_image[i, j, x]) * (simGrad.get() / 100)
|
|
|
|
|
|
|
|
return self.sim_image
|
|
|
|
|
|
|
|
|