From 8e60e74978ca9f39d21d6b325bb26b826b3947e1 Mon Sep 17 00:00:00 2001 From: Alexey Kruglov Date: Fri, 18 Nov 2016 21:24:17 +0300 Subject: [PATCH] Fix histogram matching with scipy 0.17.0 --- enhance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enhance.py b/enhance.py index 5d704d3..d4ac496 100755 --- a/enhance.py +++ b/enhance.py @@ -540,8 +540,8 @@ class NeuralEnhancer(object): (Ha, Xa), (Hb, Xb) = [np.histogram(i, bins=bins, range=rng, density=True) for i in [A, B]] X = np.linspace(rng[0], rng[1], bins, endpoint=True) 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) + inv_Ha = scipy.interpolate.interp1d(X, Hpa, bounds_error=False, fill_value='extrapolate') + map_Hb = scipy.interpolate.interp1d(Hpb, X, bounds_error=False, fill_value='extrapolate') return map_Hb(inv_Ha(A).clip(0.0, 255.0)) def process(self, original):