我已经计算了每个图像的 cdf 值,现在我必须将参考图像值映射到 target 。我不能使用直方图均衡或插值,我只需要映射它们。
function S = histM(t, target)
if size(target,2)>1
%an image, replace the image with its cdf
target = getImageCDF(target);
end
%get the CDF for the input image
tcdf = getImageCDF(t);
% .... what shall be done here to map the values of reference to target
%subfunction: compute the CDF for an image that started as uint8
function cdf = getImageCDF(img)
bins = 0:255;
H = hist(img(:), bins);
Hmod = H + eps(sum(H));
cdf = [0, cumsum(Hmod)/sum(Hmod)];




