5: Histogram Manipulation

A dark image and its color intensity distribution

The previous post introduced the distribution plots of the channel values. Let us consider this dark image. The histogram of the channel values shows that most pixels have low intensity values. We want to make this distribution uniform, which is equivalent to making the CDF (blue) linear (red).

Actual vs Target CDF

This is done by interpolating the frequency and bins of the original image to the CDF and the target bins and frequency of certain distributions.

Setting target bins and frequency

Here “f” can be any of the distributions available in scipy.stats

Experimenting with different Distributions

Linear, Norm(70, 90), Cosine(10, 100), and Logistic(150, 60) were applied. Furthermore, this needs to be conducted separately per channel. It appears that the cosine interpolation was able to bring out the colors while maintaining a decent amount of darkness.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nisarg Nigam

Nisarg Nigam

MS Data Science student at Asian Institute of Management