📊 Histogram Specification / Matching
1. Input Image
2. Target Image
3. Input Histogram
4. Target Histogram
5. Input CDF
6. Target CDF
7. Gray-Level Mapping
| Input Gray | Input H | Input CDF | Target Gray | Target CDF | New Map |
|---|
8. New Mapped Image
9. Histogram After Mapping
10. Mapping Result
🧮 Histogram Matching Mathematics
For an RGB pixel:
For each gray level rk, count the number of pixels.
If N is the total number of pixels:
where j = 0 to k.
For every input gray level, find the target gray level whose CDF is closest to the input CDF.
Every pixel having gray level r is replaced with the mapped gray level z.
Suppose the target histogram has:
The closest target CDF is 0.61, therefore: