I've got the following image:
And I'm doing the following
img = skimage.io.imread('original.jpg')
that has the following histogram:he_img = skimage.exposure.equalize_hist(a)
, I get the following histogram: skimage.io.imsave(fname = 'he.jpg', arr= he_img)
saved = skimage.io.imread('he.jpg')
What else do I need to add to my process in order to being able to save the equalized image?
The problem with this was that I was using JPG
. JPG
uses lossy compression to save images, adding noise to the image affecting to the equalization and increassing the images entropy.
To solve this I tried PNG
that is a lossless compression format for storing images. The code for this is:
img = skimage.io.imread('original.jpg')
hist_equalized_img = skimage.exposure.equalize_hist(img)
skimage.io.imsave(fname = 'he.png', arr= hist_equalized_img)