From 9d2aa3c436d6d3734e7b4cd60fcb56f22620951d Mon Sep 17 00:00:00 2001 From: "Alex J. Champandard" Date: Sat, 12 Nov 2016 15:43:23 +0100 Subject: [PATCH] Fix histogram colors overflowing in certain images. Closes #73. --- enhance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enhance.py b/enhance.py index 1b808ac..585d85e 100755 --- a/enhance.py +++ b/enhance.py @@ -542,7 +542,7 @@ class NeuralEnhancer(object): Hpa, Hpb = [np.cumsum(i) * (rng[1] - rng[0]) ** 2 / float(bins) for i in [Ha, Hb]] inv_Ha = scipy.interpolate.interp1d(X, Hpa, bounds_error=False) map_Hb = scipy.interpolate.interp1d(Hpb, X, bounds_error=False) - return map_Hb(inv_Ha(A)) + return map_Hb(inv_Ha(A).clip(0.0, 255.0)) def process(self, original): # Snap the image to a shape that's compatible with the generator (2x, 4x)