Image Histogram Matching Using CDF

3 visualizzazioni (ultimi 30 giorni)
YongHyun
YongHyun il 17 Mag 2016
Commentato: Tejas il 19 Mag 2016
I wrote a code for image histogram matching using CDF (cumulative distribution function). However, the CDF of result image is differ from the reference image. Please, check the codes and inform me the problems. Note that image is not a 8 bit and has decimal places. Thanks.
reference % reference image
input % input image
re_k = unique(reference(:));
in_k = unique(input(:));
[x,y] = size(input);
[re_counts, re_bins] = hist(reference(:),re_k);
re_cdf = cumsum(re_counts) / sum(re_counts);
[in_counts, in_bins] = hist(input(:),in_k);
in_cdf = cumsum(in_counts) / sum(in_counts);
LU = interp1(re_cdf,re_bins,in_cdf);
test = interp1(re_bins, LU, in(:));
result = reshape(test,x,y);
  1 Commento
Tejas
Tejas il 19 Mag 2016
Hello YongHyun ,
There is a MATLAB function called ' imhistmatch ' which adjusts the histogram of an image to match N-bin histogram of a reference image. You can try to use this.
-Tejas

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by