Greyscale Equalization

Use JavaScript to equalize the greyscale color of an image.
Let's play around with equalization. This takes a little more work. First we have to get the grey scale and the equalization lookup table. Once we've done that, it's just about going pixel by pixel and transforming the image to spread out the distribution. I found out that my cat's picture wasn't a really good start for this, because the image already was pretty well distributed. This is a several step process. First the image is converted to a grey scale image. Then we calculate the greyscale distribution of the image. Then we calculate the equalization lookup table. This is a probability distribution that tries to equalize the distribution of the probability of a grey scale value.
Original Image
The Equalized Image
The greyscale distributions
Choose your own image

Published on 21 January 2015

Brian Hoover is a full stack software engineer with many years of experience. He's also a facilitator at the University of Phoenix