Histogram colormap

hist map

1. Principle

code:https://github.com/rossgoodwin/hmap

Use the queue to record the index of hist src > tgt, src < tgt, src = tgt.
Then, for each hist excess, move it to hist deficit for filling.
Note that the way of filling here is sliding filling and sampling (all pixels with value val are randomly selected for replacement).

What is the difference compared to histogram specification?
It is guaranteed that the histograms are completely consistent. While histogram specification does not guarantee

It is reasonable to modify the source code as follows:
insert image description here

2. Grayscale image

If you follow the source code, the effect is as follows:
insert image description here

After modification:
insert image description here

3. For color images

The original code effect:
R,G,B :
insert image description here

insert image description here

insert image description here

insert image description here

The modified code effect:
R:
insert image description here

G:
insert image description here

B:
insert image description here

final result:
insert image description here

4. The effect of histogram specification

The histogram normalization (right) is smoother.
insert image description here

Guess you like

Origin blog.csdn.net/tywwwww/article/details/130081395