Skip to content

Instantly share code, notes, and snippets.

@quocdat32461997
Last active January 27, 2020 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quocdat32461997/910ef44cda1eda81f1b66864ddd77475 to your computer and use it in GitHub Desktop.
Save quocdat32461997/910ef44cda1eda81f1b66864ddd77475 to your computer and use it in GitHub Desktop.
def upcontrastImage(image):
hist = histogram.histogram(image)
stretched_hist = histogram.eq_hist(hist, 256, image.size)
enhanced_image = np.zeros(shape = image.shape)
height = len(image)
width = len(image[0])
for row in range(height):
for col in range(width):
enhanced_image[row, col] = stretched_hist[image[row, col]]
return enhanced_image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment