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

Commit

Permalink
Fix histogram colors overflowing in certain images. Closes #73.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjc committed Nov 12, 2016
1 parent 904071d commit 9d2aa3c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion enhance.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ def match_histograms(self, A, B, rng=(0.0, 255.0), bins=64):
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)
Expand Down

0 comments on commit 9d2aa3c

Please sign in to comment.