Image Histogram Matching Using CDF

3 vues (au cours des 30 derniers jours)
YongHyun
YongHyun le 17 Mai 2016
Commenté : Tejas le 19 Mai 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 commentaire
Tejas
Tejas le 19 Mai 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

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by