Skip to content
This repository was archived by the owner on Jan 2, 2021. It is now read-only.

Commit b3a9ba5

Browse files
authored
Merge pull request #93 from AlexeyKruglov/fix-hist
Fix histogram matching with scipy 0.17.0
2 parents 4ee13f5 + 8e60e74 commit b3a9ba5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

enhance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,8 @@ def match_histograms(self, A, B, rng=(0.0, 255.0), bins=64):
540540
(Ha, Xa), (Hb, Xb) = [np.histogram(i, bins=bins, range=rng, density=True) for i in [A, B]]
541541
X = np.linspace(rng[0], rng[1], bins, endpoint=True)
542542
Hpa, Hpb = [np.cumsum(i) * (rng[1] - rng[0]) ** 2 / float(bins) for i in [Ha, Hb]]
543-
inv_Ha = scipy.interpolate.interp1d(X, Hpa, bounds_error=False)
544-
map_Hb = scipy.interpolate.interp1d(Hpb, X, bounds_error=False)
543+
inv_Ha = scipy.interpolate.interp1d(X, Hpa, bounds_error=False, fill_value='extrapolate')
544+
map_Hb = scipy.interpolate.interp1d(Hpb, X, bounds_error=False, fill_value='extrapolate')
545545
return map_Hb(inv_Ha(A).clip(0.0, 255.0))
546546

547547
def process(self, original):

0 commit comments

Comments
 (0)