All resources that I have found a very different and I am not sure what I have to do.
Now I already got my histogram which was pretty straight forward, I also got my cumulative histogram
I don’t know how I have to use this new histogram to get a better contrast in my image. It is a image from 0 to 255 -> black to white (Pseudo code would be enough)
I am not able to make this connection on my own.
ps: It’s about the general idea.
High contrast images have gaps (zeros or near zeros), that appear on “left” and “right” (high and low) sides of histogram. Reduction of contrast can be achieved by remapping lightness values to a wider range.
Lets say on a histogram you have all values filled with 0 up until index=35 (histogram[35]) and then all 0 after index=200 (histogram[200]). Remapping of 35 to 0, and 200 to 255 and interpolation everything in between accordingly will reduce total image contrast.
To increase contrast, a reverse of the above should be applied, so that the histogram is “compressed” from low and high ends.