In [1]:
%pylab inline
from skimage import exposure, io, color
import matplotlib.pyplot as plt
Populating the interactive namespace from numpy and matplotlib
In [2]:
image = io.imread('/tmp/low_contrast.png')
In [6]:
# Do some local histogram equalization
eq = exposure.equalize_adapthist(image[..., :3])
In [7]:
# Boost the saturation a tad
hsv = color.rgb2hsv(eq)
h = hsv[..., 1]
h *= 1.5
h[:] = h.clip(0, 1)
out = color.hsv2rgb(hsv)
In [8]:
# And increase the contrast using gamma adjustment
gamma = exposure.adjust_gamma(out, 1.1)
f, (ax0, ax1) = plt.subplots(1, 2, figsize=(15, 5))
ax0.imshow(image)
ax1.imshow(gamma)
f.suptitle(u'Et voilĂ !', fontsize=16)
plt.show()
In [ ]: