Image Histogram Matching Using CDF

조회 수: 8 (최근 30일)
YongHyun
YongHyun 2016년 5월 17일
댓글: Tejas 2016년 5월 19일
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
Tejas
Tejas 2016년 5월 19일
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

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by